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

Re: counting question

Subject: Re: counting question
From: Jeni Tennison <jeni@xxxxxxxxxxxxxxxx>
Date: Wed, 9 Jan 2002 07:30:59 +0000
Re:  counting question
Hi Jo,

> I am wanting to count all the child elements of a particular element
> and treat them one way if there is only one child and another if
> there are multiple. Is the best way to do this to test if the child
> is both first and last or is there some other more sensible method?

You can do it using the count() function:

  count(*) = 1

returns true if the context node has exactly one child element.

Another method is to test whether there is a second child element:


returns true if there isn't a second child element (i.e. if there are
0 or 1 child elements).



Jeni Tennison

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

Current Thread
  • counting question
    • Jo Bourne - Wed, 9 Jan 2002 01:56:02 -0500 (EST)
      • Martijn - Wed, 9 Jan 2002 02:08:26 -0500 (EST)
      • Mike Brown - Wed, 9 Jan 2002 02:09:45 -0500 (EST)
      • Message not available
        • Jeni Tennison - Wed, 9 Jan 2002 02:29:53 -0500 (EST) <=
      • Jo Bourne - Wed, 9 Jan 2002 03:14:04 -0500 (EST)
      • Michael Kay - Wed, 9 Jan 2002 06:51:05 -0500 (EST)


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.
First Name
Last Name
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.