Subject: [xsl] selection on position From: subbu@xxxxxxxxxxxx Date: Tue, 23 Jul 2002 10:17:28 +0100 |
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
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Grouping and filtering, Vasu Chakkera | Thread | Re: [xsl] selection on position, David Carlisle |
Re: [xsl] content of matched node ?, Jochen Metzger | Date | Re: [xsl] selection on position, David Carlisle |
Month |