From: "Christian Barth" <[EMAIL PROTECTED]>
Date: Wed, 18 Jan 2006 19:20:37 +0100
Hi!
I want to define a global variable with no value.
Then I want to asign a value to the variable in a choose-when-select.
I think of something like this (but this one doesn't work):
<xsl:variable name="element" />
<xsl:for-each select="*">
<xsl:choose>
<xsl:when test="local-name() = 'rettungswege'">
<xsl:variable name="element" select="rettungswege/rw" />
</xsl:when>
<xsl:when test="local-name() = 'trennwaende'">
<xsl:variable name="element"
select="trennwaende/trennwand"
/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
<xsl:for-each select="$element">
...do something...
</xsl:for-each>
Is this possible?
No, because that's not how variables work in XSL. Once they're assigned
they're visible at that level and below, and you can't change them. You
have to use something structured more like
<p>Try visiting<ul>
<xsl:for-each select="tutorial">
<xsl:variable name="foo">
<xsl:choose>
<xsl:when test="@id = '1'>
http://www.topxml.com/xsl/tutorials/intro/default.asp
</xsl:when>
<xsl:when test="@id = '2'>
http://en.wikipedia.org/wiki/XSLT
</xsl:when>
<xsl:otherwise>
http://www.jenitennison.com/xslt/
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<li><xsl:value-of select="$foo"/></li>
</xsl:for-each>
</ul></p>
This isn't really a Cocoon issue, though, and there are plenty of dedicated
XSL sites and mailing lists...
Andrew.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]