This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: testing an attribute value and node value


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]