[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Newbie question: how to count equal nodes into one resul

Subject: RE: Newbie question: how to count equal nodes into one result element
From: "Harbarth, Juliane" <jhb@xxxxxxxxxxxxxx>
Date: Mon, 21 Jun 1999 16:26:55 +0200
xsl variable equal
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">

 	<xsl:template match="/">
 	 <result>
	  <xsl:apply-templates/> 
 	 </result>
 	</xsl:template>

    	<xsl:template match="tag">
	 <xsl:variable name="currentFruit"><xsl:value-of
select="."/></xsl:variable>
	 <xsl:variable name="others">
	  <xsl:number
expr="count(from-preceding-siblings(tag[from-self(*)=$currentFruit]))"/>
	 </xsl:variable>
	 <xsl:if test="$others=0">
	  <tag>
	   <value><xsl:value-of select="."/></value>
	   <occurred>
	    <xsl:number
expr="count(from-following-siblings(tag[from-self(*)=$currentFruit])) + 1"/>
	   </occurred>
	  </tag>
	 </xsl:if>
    	</xsl:template>

</xsl:stylesheet>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.