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

Re: Make selection depending on value n-th child eleme

Subject: Re: Make selection depending on value n-th child element
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Sat, 18 May 2002 17:24:14 +0100
Re:  Make selection depending on value n-th child eleme
Hi Martin,

> I want to be able to do this for the n-th value. I've tried <xsl:if
> test="./value[1] &gt; 0"> to test the second value but this does not
> work. How do I address the value the n-th child element to make a
> selection?

That's the right kind of thing, but remember that XPath indexes count
from 1 rather than from 0, so:

  <xsl:if test="value[1] > 0">...</xsl:if>

tests whether the *first* value element has a value greater than 0. If
you want to test the second, then use:

  <xsl:if test="value[2] > 0">...</xsl:if>

You don't need to do ./value -- that just tells the processor to go
from the context node to its child value element, and all relative
paths go from the context node anyway.

Also note that value > 0 tests whether *any* value element child has a
numeric value greater than 0, rather than testing the last one.
  
Cheers,

Jeni

---
Jeni Tennison
http://www.jenitennison.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.