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

Re: conditional element counting

Subject: Re: conditional element counting
From: "Dimitre Novatchev" <dnovatchev@xxxxxxxxx>
Date: Thu, 28 Aug 2003 22:12:13 +0200
xslt conditional count
> I would like to count the number of nodes that have an element containing
a
> specific element value.  Can this be done in XSL?

count(/*/Person[Age = 10])

The above is an XPath expression which, when evaluated returns the wanted
value.

Note, that this XPath expression doesn't rely/know about XSLT -- one could
evaluate it using DOM.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


"Darren Kuik" <darren.kuik@xxxxxxx> wrote in message
news:OPEOKKGGODFCPNLFHGPBOEKPCFAA.darren.kuik@xxxxxxxxxx
> I would like to count the number of nodes that have an element containing
a
> specific element value.  Can this be done in XSL?  I couldn't find this in
> the archive so I apologize if this has been posted before?
>
> Suppose I have an XML file that looks like this:
>
> <Rootnode>
>   <Person>
>     <Name>Joe</Name>
>     <Age>10</Age>
>   </Person>
>   <Person>
>     <Name>John</Name>
>     <Age>10</Age>
>   </Person>
>   <Person>
>     <Name>Sam</Name>
>     <Age>18</Age>
>   </Person>
>
> I want to use XSL to count and display the number of Person nodes that
have
> an Age element with value = 10.  Is this possible?
>
> Thanks,
> Darren
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>




 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.