[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] Contitional statement


Subject: RE: [xsl] Contitional statement
From: "Michael Kay" <mhkay@xxxxxxxxxxxx>
Date: Wed, 13 Jun 2001 10:52:07 +0100

> > <xsl:value-of select="ROW/KEY[id=$var]"/>
> > is this right to use....
> This is correct XSL-T, but the result might not be what you expect:
>
> input:
> <row>
>   <key id="foo">foo1</key>
>   <key id="bar">bar1</key>
>   <key id="foo">foo2</key>
>   <key id="bar">bar2</key>
> </row>
>
> <xsl:variable name="var">foo</xsl:variable>
> <xsl:value-of select="row/key[id=$var]"/>
>
> will result in:
>
> "foo1 foo2"
>
Wrong. It will result in "foo1". <xsl:value-of>, given a node-set, takes the
string value of the first node.

Mike Kay
Software AG


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



Current Thread