cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pannetier Alain <Alain.m.Pannet...@atosorigin.com>
Subject RE: How to asign a value to a variable??
Date Thu, 19 Jan 2006 07:57:52 GMT
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:cocoon@barth-zone.de
<mailto:cocoon@barth-zone.de> ] 
Sent: 18 January 2006 19:21 
To: users@cocoon.apache.org 
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 


Mime
View raw message