Hi Hans,
If you need the variable to contain references to the original nodes (rather
than copies of the original nodes placed into a result tree fragment) then
you can usually accomplish this using XPath predicates. For example, taking
your original code and modifying it a little...
<xsl:variable name="foo">
<xsl:if test="$bar=''">
<xsl:copy-of select="//a"/>
</xsl:if>
<xsl:if test="not($bar='')">
<xsl:copy-of select="//b"/>
</xsl:if>
</xsl:variable>
then using XPath predicates you could do...
<xsl:variable name="foo" select="//a[$bar=''] | //b[not($bar='')]"/>
Hope this helps
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator
"Hans-Michael Rupp" <ha*******@danet.de> wrote in message
news:3F**************@danet.de...
Hello!
I need to a assign a node(-set) conditionally to a varialbe like:
<xsl:variable name="foo">
<xsl:if test="$bar=''">
<!-- how can I access a node here ?-->
</xsl:if>
<xsl:if test="not($bar='')">
<!-- how can I access a node here ?-->
</xsl:if>
</xsl:variable>
but how can I do it? I would need a <xsl:select> tag, which does not
exist.
I would be gratefull for any suggestions.
Greetings,
Hans