[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Node-List in Variables

Subject: Node-List in Variables
From: "Hayk, Matthias" <Matthias.Hayk@xxxxxxxxxx>
Date: Fri, 2 May 2003 11:00:59 +0200
xsl tokenizer
Hello,

i want to tokenize a string, delimited  with a special character, into its
tokens and want this tokens to be a result-tree which i can handle with an
xsl:for-each.

myexample
the first xsl:variable call the template tokenizer which creates the
t1-elements recursivly for all string elements (a, b and c).
i would expect that the variable tlist contains
<t1>a</t1><t1>b</t1><t1>c</t1> which i then want to work on with the
xsl:for-each, but the xslt-processor gives the error that the expression in
xsl:for-each must evaluate to a node-set. if i use the ms-xslt-nodeset
function i get only one node which contains the textvalues of the elements (
in my example it containt abc). so it seems, that tlist only contains a
string.

any idea what is wrong and how i can achieve my goal?

regards
matthias 


<xsl:variable name="tlist">
	<xsl:call-template name="tokenizer">
		<xsl:with-param name="tokenstr" select="a|b|c|"/>
	 </xsl:call-template>
</xsl:variable>

<xsl:for-each select="$tlist">
	<xsl:value-of select="."/>
</xsl:for-each>	


<xsl:template name="tokenizer">
	<xsl:param name="tokenstr"/>
	
	<xsl:variable name="akttoken"
select="normalize-space(substring-before($tokenstr,'|'))"/>
	<xsl:if test="string-length($akttoken) &gt; 0">
		<!-- Ist noch nen Token da -->
		<xsl:element name="t1">
			<xsl:value-of select="$akttoken"/>
		</xsl:element>
		<xsl:call-template name="tokenizer">
			<xsl:with-param name="tokenstr"
select="substring-after($tokenstr,'|')"/>
		</xsl:call-template>
	</xsl:if>
</xsl:template>

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.