RE: testing an attribute value and node value

Subject: RE: testing an attribute value and node value
From: Kay Michael <Michael.Kay@xxxxxxx>
Date: Tue, 19 Sep 2000 09:43:51 +0100
> My XML is;
> 
> <?xml version='1.0'?>
> <PageData>
>        <CUSTOM>
>             <F n="100">1</F>
>             <F n="101">1</F>
>        </CUSTOM>
> </PageData>
> 
 
> So, if current node n="100" and the current node value = '1' 
> then output
> 
>     <B>100 Works</B>
> 
> if current node n="101" and the current node value = '1' then output
> 
>     <B>101 Works</B>
> 
> My XSL looks like;
> 
> <xsl:template match="F">
> <DIV>
>   <xsl:choose>
>       <xsl:when test="@n[.='100' and //F[.='1']]"><B>100
> Works</B></xsl:when>
>       <xsl:when test="@n[.='101' and  //F[.='1']]"><B>101
> Works</B></xsl:when>
>   </xsl:choose>
>  </DIV>
> 
> </xsl:template>
> 
Oh dear, you are very confused. Your condition is testing "if the current
node has an @n attribute whose value is '100', and if the document contains
an F element whose string-value is '1'.

Try <xsl:when test="@n='100' and .='1'">

Mike Kay


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


Current Thread