Re: [xsl] How to assign a sequence to a variable?

Subject: Re: [xsl] How to assign a sequence to a variable?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 9 Aug 2005 15:04:05 +0100
If you go

	<xsl:variable name="tempb">
		<xsl:value-of select="'b1','b2','b3'"/>
	</xsl:variable>

Then you generate a sequence of length 1 consisting of a document node,
this document node has a single text node child consisting of teh result
of applying value-of.

So don't do that, either use a select attribute as in tempa or use as="item()*"
also (as in xslt1) xsl:value-of always generates a text node, and here
you want a sequence so use xsl:sequence instead:

	<xsl:variable name="tempb" as="item()*">
		<xsl:sequence select="'b1','b2','b3'"/>
	</xsl:variable>

same in teh call-template case:

	<xsl:message select="$tempb[1]"/>
	<xsl:variable name="tempc" as="item()*">
		<xsl:call-template name="processName">
		</xsl:call-template>
	</xsl:variable>
	<xsl:message select="$tempc[1]"/>
</xsl:template>
<xsl:template name="processName">
	<xsl:sequence select="'c1','c2','c3'"/>
</xsl:template>

David

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________

Current Thread