Subject: Re: [xsl] count hits/matches - INCREMENT From: David Carlisle <davidc@xxxxxxxxx> Date: Mon, 20 Jun 2005 16:08:48 +0100 |
This seems to be a standard grouping question (see the faq or Jeni Tennison's pages) Also It's helpful if you post a well formed xml file (rather than the browser-view of the file with - markes in the first column and unescaped & in the text. I think you just want something like the code below. David <revision-list> <revision> <revision-id>1</revision-id> <revision-date>2005-05-03</revision-date> <revision-description>Initial (first) Revision of D&D Plan</revision-description> </revision> <revision> <revision-id>2</revision-id> <revision-date>2005-06-03</revision-date> <revision-description>Second Issue of D&D Plan</revision-description> </revision> <revision> <revision-id>3</revision-id> <revision-date>2005-07-03</revision-date> <revision-description>Third Issue of D&D Plan</revision-description> </revision> <revision> <revision-id>6</revision-id> <revision-date>2005-07-03</revision-date> <revision-description>Fourth Issue</revision-description> <error>There isn't any plans listed!</error> </revision> </revision-list> <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chart="abc" version="1.0" > <xsl:output indent="yes"/> <xsl:key name="r" match="revision" use="revision-date"/> <xsl:template match="revision-list"> <chart:seriesgroup series="revision"> <xsl:for-each select="revision[generate-id()=generate-id(key('r',revision-date))]"> <xsl:sort select="revision-date"/> <chart:category-item value="{count(key('r',revision-date))}" category="{revision-date}" /> </xsl:for-each> </chart:seriesgroup> </xsl:template> </xsl:stylesheet> $ saxon gg.xml gg.xsl <?xml version="1.0" encoding="utf-8"?> <chart:seriesgroup xmlns:chart="abc" series="revision"> <chart:category-item value="1" category="2005-05-03"/> <chart:category-item value="1" category="2005-06-03"/> <chart:category-item value="2" category="2005-07-03"/> </chart:seriesgroup> ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] count hits/matches - INCR, Dariusz Borowski | Thread | Re: [xsl] count hits/matches - INCR, Dariusz Borowski |
Re: Antw: Re: [xsl] join two files , Michael Donabauer | Date | RE: [xsl] output in table, cknell |
Month |