[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: count hits/matches - INCREMENT
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 ________________________________________________________________________
|
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
|