xsl-list
[Top] [All Lists]

RE: Can I use variables in location paths?

2003-05-27 06:23:59
Hi,

What I'd like to do is this (note use of variable)

              <xsl:variable name="Scenario">BASECASE</xsl:variable>
              <xsl:variable name="Date">20030408</xsl:variable>

              <xsl:for-each 
select="PositionFactorLevels/Scenario[ @Name='${Scenario}' 
]/Factor/Data[ @Date= '${Date}' ]">
                              <xsl:value-of select="../@Name" 
/> = <xsl:value-of select="." /> <br></br>
              </xsl:for-each>         

  @Name='${Scenario}'

Means you're testing if the Name attribute is equal to the string 
"${Scenario}"; see <http://www.w3.org/TR/xpath#NT-VariableReference>. Instead 
use

  <xsl:for-each select="PositionFactorLevels/Scenario[(_at_)Name = 
$Scenario]/Factor/Data[(_at_)Date = $Date]">

Cheers,

Jarno - Neurotic Fish: Prostitute

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



<Prev in Thread] Current Thread [Next in Thread>