Struggling to iterate over tokenized string 2007-04-09 - By Dave Brosius
Thanks, all, for the input. For the curious, this seems to work as desired
<xsl:transform version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan" exclude-result-prefixes="xalan">
<xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:param name="input"/>
<xsl:template match="/"> <xsl:element name="test"> <xsl:for-each select="xalan:tokenize($input, ',')"> <xsl:element name="{string(.)}"/> </xsl:for-each> </xsl:element> </xsl:template> </xsl:transform>
-----Original Message----- From: david_marston@(protected) Sent: Mon, April 9, 2007 11:24 am To: xalan-j-users@(protected) Subject: Re: Struggling to iterate over tokenized string
Dave Brosius asked about: <xsl:for-each select="tokenize($input, ',')"> <xsl:element name="{name(.)}"/> </xsl:for-each>
In addition to needing a namespace qualifier for the tokenize function, I think you probably meant to extract the value of each node, rather than the name. If tokenize is returning a node-list, they would likely be anonymous nodes. How about this? <xsl:element name="{string(.)}"/> .................David Marston
|
|