RE: [xsl] reccursive sum ?

Subject: RE: [xsl] reccursive sum ?
From: "Ricaud Matthieu" <matthieu.ricaud@xxxxxxx>
Date: Thu, 4 Mar 2004 12:05:59 +0100
Concerning the total sum I noticed that if theres many times the same ME in
my LIST.xml file :
	<ME id="0010"/>
	<ME id="0010"/>
	<ME id="0045"/>
	<ME id="0152"/>

The <xsl:value-of
will count the number of DEVOIR only once for the ME 0010. However the
addxml node-set contains twice <ME id="0010.xml">!
Does the count function, only count things that are from differents files ?

Offcourse there shall not be twice ME with the same id, but nothing prevent
it in my project and I would like the sum to be always right.

-----Message d'origine-----
De : owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]De la part de Ricaud
Envoyé : mercredi 3 mars 2004 13:56
À : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet : RE: [xsl] reccursive sum ?

Thanks David, i think i see the things better now.
I'm trying to use the whole node set of my xml files to count the DEVOIRS
but i still have a little problem using

My xslt processor is MSXML, the node-set function is msxsl:node-set (I added
xmlns:msxsl="urn:schemas-microsoft-com:xslt" in the namespace declaration)
One more thing is that my xml files are not in the same folder, i need to go

This is what i wrote :

<xsl:call-template name="SUM">
	<xsl:with-param name="addxml">
		<xsl:for-each select="ME">
			<xsl:attribute name="id">../ME/<xsl:value-of


PS : I need to use a template because i have to calculate this sum for many
ME node-Set in my xml

Oups, at the moment i'm writing those lines, i tested the code more and more
and finaly it work !!!
I let the lines, maybe you'll tell me it can be improve ;)
Anyway, i now really understand what you meant :
I don't need reccurive template since msxsl:node-set($addxml)/ME/@id is a
node-set and document(this node-set) will go through all the documents
described in the node-set and then count(document(this node-set)/Xpath) will
count the total
amount on the whole documents. That's clear and incredibly powerfull and
quite fine !
One more time thanks a lot David, and sorry that i needed so much time to
understand the whole meaning of your solution.

-----Message d'origine-----
De : owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx
[mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx]De la part de David
Envoyé : mardi 2 mars 2004 19:22
À : xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Objet : Re: [xsl] reccursive sum ?

  The goal of all this transformation is to prevent using a variable, is it
  I find it's a lot to do (it has many consequences on the whole project)
  don't see perfectly what the use of it.

why is it a lot to do? it just makes one variable which takes three or
four lines immediately before you call sum() as I showed in my post.


No, that makes the argument to document a string and you want it to be a
node set where each node has teh uri of a document, tehn document() will
load all the files in one go and sum() can take teh sum over all teh
files, as you requested.

If you don't do this, you'll ned to do a recursve template as I think
others have shown, which will certainly be a lot more code, it may or
may not be more efficient depending on implementation details of your
processor, however I'd guess usually it would be slower.



This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

 XSL-List info and archive:

 XSL-List info and archive:

 XSL-List info and archive:

Current Thread