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

Re: Summing grouped elements

Subject: Re: Summing grouped elements
From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx>
Date: Sat, 12 Feb 2005 02:04:41 -0800 (PST)
sport summing
You can use count function for this..

<xsl:template match="/cars">
  <xsl:value-of select="count(car[categ='Sport'])" />
  <xsl:value-of select="count(car[categ='Pick-up'])"
/>
</xsl:template>

In the XML you have given, you have mentioned sport
and Sport ,and pick-up and Pick-up (please note the
case of 1st letter). sport and Sport will be treated
differently..

Either you have to make data "case identical", or you
may use like this..
<xsl:value-of select="count(car[categ='sport' or
categ='Sport'])" />
<xsl:value-of select="count(car[categ='pick-up' or
categ='Pick-up'])" />

Regards,
Mukul

--- Marcos Hercules dos Santos <mhercules@xxxxxxxxx>
wrote:

> Hi  people . David Carlisle , I'm Sorry.  I think
> that I became my
> problem in some very complex
>  hard to understand.
> 
> I translate it this way:  If i have this XML
> 
> <cars> 
>    <car>
> 		<model>V667320</model>
> 		<name>Sportage</name>
>                 <categ>sport</categ>
> 
>    </car>
>    <car>
> 		<model>M382932</model>
> 		<name>Silverado</name>
>                <categ>pick-up</categ>
>  </car>
>  <car>
> 		<model>L930389</model>
> 		<name>Jaguar</name>
>                 <categ>Sport</categ>
>   </car>
>   <car>
> 		<model>J980384</model>
> 		<name>Ranger</name>
>                 <categ>Pick-up</categ>
>   </car>
> </cars>
> 
> I Think  through this example you'll understand what
> I want to do.  
> 
> The question: I have Two categories: sport and
> Pick-up. Ok? 
> 
> How can I  using XSL to obtain the Total value by
> category, in this
> case  = 2 ?     Thanks .
> 
> 
>   Marcos Hercules dos Santos



		
__________________________________ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

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.