This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
selection on position
- From: subbu at boltblue dot com
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Tue, 23 Jul 2002 10:17:28 +0100
- Subject: [xsl] selection on position
- References: <F5DVWt76NsOUzdMMCu200006ff7@hotmail.com>
- Reply-to: xsl-list at lists dot mulberrytech dot com
hi i have a problem which is not working the way i wud have thot it should work.
i have an xml that looks like
<colors>
<color>red</color>
<color>blue</color>
<color>green</color>
</colors>
and i want to match a pattern based on a condition..
( this is a purely experimental example.. and is intended to understand xsl )
i want to get the second color element ie blue
i can do something like
<xsl:template match="colors">
<xsl:value-of select="color[position()=2]"/>
</xsl:template>
---or---
<xsl:template match="/">
<xsl:value-of select="/colors/color[position()=2]"/>
</xsl:template>
-------------------------------------------------
however, something like
<xsl:template match="/colors/color[position()=2]">
<xsl:value-of select="."/>
</xsl:template>
would gimme all colors, ignoring the condition...
I am not sure what happens behind.. any explaination to this is appreciated
thanks
--------------------------------------------------------------
Sent with "Me-Mail", Boltblue's FREE mobile messaging service.
http://www.boltblue.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list