RE: [xsl] Node Exist

Subject: RE: [xsl] Node Exist
From: Jarno.Elovirta@xxxxxxxxx
Date: Mon, 26 May 2003 13:01:24 +0300
Hi,

>   Matched ist <document>... when it runs the follow xsl:if, it is in a
> for-each and scans every object of old. Now i must know if 
> exist the node in
> <new>...
> 
>   <xsl:if test="//*/*/*/security-object[@id = 'TESTNODE']">
>      DOES WORK
>   </xsl:if>
> 
>   <xsl:variable name="node">TESTNODE</xsl:variable>
>   <xsl:if test="//*/*/*/security-object[@id = '$node']">

Remove the quotes, i.e.

  <xsl:if test="//*/*/*/security-object[@id = $node]">

because with the quotes you're testing if the id attribute is equals to string "$node", not the string value of variable node. Also, it's better to use 

  <xsl:variable name="node" select="'TESTNODE'"/>

to bind a string to a variable.

Cheers,

Jarno - Dulce Liquido: Humid Dreams

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


Current Thread
  • [xsl] Node Exist
    • Jack Dubovski - Mon, 26 May 2003 11:46:31 +0200 (MEST)
      • <Possible follow-ups>
      • Jarno . Elovirta - Mon, 26 May 2003 13:01:24 +0300 <=