RE: [xsl] count hits/matches - INCREMENT

Subject: RE: [xsl] count hits/matches - INCREMENT
From: Dariusz Borowski <d.borowski@xxxxxx>
Date: Mon, 20 Jun 2005 16:47:42 +0200
Thanks for the good advises.

Maybe I should explain much better, what  I try to do....

xml-file:
=====================
<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>

============================

Now, over XSL I try to filter all that. For example the result should look
like this:

============================

- <chart:seriesgroup series="revision">
  <chart:category-item value="2" category="2005-07" />
  <chart:category-item value="1" category="2005-06" />
  <chart:category-item value="1" category="2005-05" />
  </chart:seriesgroup>

============================

In this xml-file I got 2 hits for the date: 2005-07.

The result what I have is:

============================

And here is my for-loop in the xsl-file:
===========================
<!-- get all revision-dates -->
			<xsl:for-each select="revision-list/revision">
			<!-- sort the dates -->
			<xsl:sort order="descending" select="revision-date" />

				<xsl:variable name="time">
				<!-- get all, NOT duplicate values -->
				<!-- <xsl:value-of select="revision-date[not(.=following::revision-date)]"
/> -->
				<xsl:value-of
select="revision-date[not(.=following-sibling::revision-date)]" />
				</xsl:variable>

				<xsl:variable name="val">
					<xsl:value-of select="count(revision-date[.=following::revision-date])+1"
/>
				</xsl:variable>



				<!-- get just the first 7 chars for the variable $time -->
				<xsl:variable name="date" select="substring($time, 1, 7)" />


				<!-- <xsl:if test="$time != ''"> -->
					<chart:category-item category="{$date}" value="{$val}" />
				<!-- </xsl:if> -->





			</xsl:for-each>

===================================

Can anybody help me?

Thanks!
Dariusz




xsl-list@xxxxxxxxxxxxxxxxxxxxxx schrieb am 20.06.05 15:36:46:
>
> >
> > My Question is, how to count hits.
>
> count($elements[condition])
>
> >
> > Is it possible in XSL to change the value of a variable in a
> > <xls:for-each> and get the value after the <xsl:for-each>?
> >
>
> No. XSLT is a functional language, not a procedural one.
>
> Michael Kay
> http://www.saxonica.com/
>


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

Current Thread