[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

selection on position

Subject: selection on position
From: subbu@xxxxxxxxxxxx
Date: Tue, 23 Jul 2002 10:17:28 +0100
xsl template match explaination
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.