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

RE: reccursive sum ?

Subject: RE: reccursive sum ?
From: "Ricaud Matthieu" <matthieu.ricaud@xxxxxxx>
Date: Tue, 2 Mar 2004 14:59:45 +0100
calling template xsl sum
Thanks Andrew for this example.
Someone on a Forum send me something in this way :

<xsl:template match="LISTE-ME">
	<xsl:for-each select="ME">
		ME <xsl:value-of select="@id"/> :
		<xsl:call-template name="NbreDevoirsME">
			<xsl:with-param name="MEid" select="."/>
		</xsl:call-template>
		 devoirs <br/>
		<xsl:call-template name="total">
			<xsl:with-param name="TheNodes" select="ME"/>
		</xsl:call-template>
	<xsl:for-each/>
</xsl:template>

<xsl:template name="total">
	<xsl:param name="TheNodes"/>
	<xsl:choose>
		<xsl:when test="not($TheNodes)">
			<xsl:value-of select="0"/>
		</xsl:when>
		<xsl:otherwise>
			<xsl:variable name="FallowingsNodesSum">
				<xsl:call-template name="total">
					<xsl:with-param name="TheNodes" select="$TheNodes[position()!=1]"/>
				</xsl:call-template>
			</xsl:variable>
			<xsl:variable name="nbDevoirs">
				<xsl:call-template name="NbreDevoirsME">
					<xsl:with-param name="MEid" select="$noeuds[1]"/>
				</xsl:call-template>
			</xsl:variable>
			<xsl:value-of select="$FallowingsNodesSum+$nbDevoirs"/>
		</xsl:otherwise>
	</xsl:choose>
</xsl:template>

<xsl:template name="NbreDevoirsME">
	<xsl:param name="MEid"/>
	<xsl:variable name="MEfile">
		<xsl:value-of select="$MEid">.xml
	</xsl:variable>
	<xsl:value-of select="count(document($MEfile)/ME/FOURN/DEVOIR"/>
</xsl:template>

Thanks philemon_siclone on
http://www.developpez.net/forums/viewforum.php?f=25


 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.