Re: [xsl] return nodeset to xsl:variable

Subject: Re: [xsl] return nodeset to xsl:variable
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Thu, 08 Mar 2001 17:20:14 +0000

Michael Kay wrote:
> 
> > I see how to set an xsl:variable by 'returning' a string from a called
> > template, but how do you return a node set to an xsl:variable?.
> 
> A called template doesn't actually return a result, it writes to a tree.
> 
> What do you actually want to achieve?
> 
A general note - if you want to get a nodeset into a variable, and it
can be generated by a single XPath expression, then you can do this with
xsl:variable/@select.

If you want to create a variable which contains a nodeset which can only
be generated with XSLT logic, then the short answer is you can't. But in
fact you can work round this if you need to badly enough by using
parameters instead, typically building up the contents of a parameter by
recursive calls until it is complete, and then calling the next stage in
your transform with your complete value as an input parameter.

Francis.

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


Current Thread