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

Re: Problem with count and predicates

Subject: Re: Problem with count and predicates
From: "M. David Peterson" <m.david.x2x2x@xxxxxxxxx>
Date: Fri, 3 Jun 2005 21:00:26 -0600
gt 2
Hey Kent,

In 1.0 or 2.0, as long as I understand what you are looking for the
following will give you want you want:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
  <xsl:apply-templates select="stats/month"/>
</xsl:template>
<xsl:template match="month">
  Month: <xsl:value-of select="@name"/>
  Days[&gt; 2]: <xsl:value-of select="count(days[. > 2])"/>
</xsl:template>
</xsl:stylesheet>

Will output:

Month: 6
  Days[&gt; 2]: 3
  Month: 7
  Days[&gt; 2]: 3

using the sample you gave....

Is this what you want?

On 6/3/05, Kent Seegmiller <hookjaw20@xxxxxxxxxxx> wrote:
> My brain must be on drugs.  I have a source doc of:
>
> <stats>
>  <month name="6" count="4842">
>  <days>0</days>
>  <days>0</days>
>  <days>0</days>
>  <days>1</days>
>  <days>6</days>
>  <days>-16</days>
>  <days>3</days>
>  <days>2</days>
>  <days>3</days>
>  <days>1</days>
> ...
> </month>
>  <month name="7" count="4537">
>  <days>0</days>
>  <days>4</days>
>  <days>9</days>
>  <days>1</days>
>  <days>2</days>
>  <days>0</days>
>  <days>2</days>
>  <days>0</days>
>  <days>10</days>
>  <days>1</days>
> ...
> </month>
> ...
> </stats>
> I want to get the count of days that are > 2 for each month and have racked
> my brain.  I think the chemo has kicked in.  Please tell me how this is
> posible using 2.0
>
> KS
>
>


--
<M:D/>

M. David Peterson
http://www.xsltblog.com

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.