Title: RE: How to asign a value to a variable??

Hi Christian,

This is probably what you want to achieve :

<xsl:variable name="element" select=
        "*[local-name()='rettungswege']/rw
       | *[local-name()='trennwaende']/trennwand"/>

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

The node-set is created by an XPath _expression_. Note the "|" that ORs your two cases.
As you probably know by now, doing it "in one go" is the only way.

Cheers

Alain
________________________________________
From: Christian Barth [mailto:[EMAIL PROTECTED]]
Sent: 18 January 2006 19:21
To: [email protected]
Subject: How to asign a value to a variable??

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?
 
Thanks,
Barthi