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

Re: Complicated count() query

Subject: Re: Complicated count() query
From: Cassandra Bonner <cbonner_98@xxxxxxxxx>
Date: Thu, 24 May 2001 22:25:21 -0700 (PDT)
cassandra bonner
See if this helps you...

http://www.dpawson.co.uk/xsl/N2018.html#d44e13410

Also, if you're parsing your document multiple times, you could add
an element or attribute for each match, then count on the second
parsing of the elements.  Not really the best solution, but an option
for you.  This example is simplified and specific to 'John', but you
could make this generic.  It only works, of course if you're using a
framework that allows for subsequent processing of your xml doc.

[Not tested]
<xsl:for-each select = "student">
  <xsl:if test="starts-with(name,'John')">
    <xsl:element name="johnCounter"/>
</xsl:if>
</xsl:for-each>


The stylesheet for the second stylesheet would then count these
nodes...

count <xsl:value-of select="count(//johnCounter)"/> (use actual path)



thx,
cass

--- Zak McGregor <zak@xxxxxxxxxxxx> wrote:
> Hi all
> 
> I have some data like this:
> 
> <list>
> 	<student>
> 		<name>John Smith</name>
> 	...
> 	</student>
> 	<student>
> 		<name>G. Whizz</name>
> 	</student>
> 	...
> </list>
> 
> and I would like to do a case-insensitive count of all "john"
> occurrences. Does anyone have any idea how to do this? I'm
> completely
> stumped.
> 
> Thanks
> 
> Zak
> 
> --
>
====================================================================
> Zak McGregor
> http://www.carfolio.com - Specifications of cars online. Over 7000!
>
--------------------------------------------------------------------
> Of course my password is the same as my pet's name.  
> My macaw's name was Q47pY!3, but I change it every 90 days.
>
====================================================================
> 
>  XSL-List info and archive: 
> http://www.mulberrytech.com/xsl/xsl-list
> 


__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.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.