[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem with count and predicates
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
|
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
|