|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Complicated count() query
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








