Subject: Re: Problem with count and predicates
From: "M. David Peterson" <m.david.x2x2x@xxxxxxxxx>
Date: Fri, 3 Jun 2005 21:00:26 -0600
|
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[> 2]: <xsl:value-of select="count(days[. > 2])"/>
</xsl:template>
</xsl:stylesheet>
Will output:
Month: 6
Days[> 2]: 3
Month: 7
Days[> 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
|