xsl-list
[Top] [All Lists]

Re: count hits/matches - INCREMENT

2005-06-20 12:05:32

Thank you very much! This is exactly what I was looking for.

Regards,
Dariusz


xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com schrieb am 20.06.05 17:09:07:


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&amp;D 
Plan</revision-description> 
  </revision>
  <revision>
  <revision-id>2</revision-id> 
  <revision-date>2005-06-03</revision-date> 
  <revision-description>Second Issue of D&amp;D Plan</revision-description> 
  </revision>
  <revision>
  <revision-id>3</revision-id> 
  <revision-date>2005-07-03</revision-date> 
  <revision-description>Third Issue of D&amp;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
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



_________________________________________________________________________
Mit der Gruppen-SMS von WEB.DE FreeMail können Sie eine SMS an alle 
Freunde gleichzeitig schicken: http://freemail.web.de/features/?mc=021179




--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--