This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: testing an attribute value and node value
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: testing an attribute value and node value
- From: Kay Michael <Michael dot Kay at icl dot com>
- Date: Tue, 19 Sep 2000 09:43:51 +0100
- Reply-To: xsl-list at mulberrytech dot com
> 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