RE: [xsl] reccursive sum ?

Subject: RE: [xsl] reccursive sum ?
From: "Ricaud Matthieu" <matthieu.ricaud@xxxxxxx>
Date: Tue, 2 Mar 2004 17:25:32 +0100
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) and
don't see perfectly what the use of it.

Is it just a question of efficiency ? It's true when I have A huge quantity
of files to scan, then it might be longer. actually there will never be more
than about 10 files to be read.

Is it to make the code shorter (and cleaner ?). In this case, would your
intermediary solution not be enough :
document(concat($Meid,'.xml')

Maybe I don't yet see everything but for sure I keep this advices and will
probably come back to it.

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



  I don't see the link between concat id + ".xml" and the <xsl:value-of
  select="document($theFileName)..."/>
  $theFileName is not a node set, no ?

That's right: if you use concat (or a xsl:variable with content) then
$theFileName is only a string and so document() will only load one file,
but if your attributes had the full file name then you could do
document(ME/@id)
and now the argument to document() _is_ a node set of all the id
attributes of all your ME elements, and in that case document() loads
_all_ of the referenced files in one go.

assuming your processor has a node-set() extension (most do) then
since you don't want to change your input you just need to go

<xsl:variable name="addxml">
<xsl:for-each select="ME">
  <ME id="{@id}.xml"/>
</xsl:for-each>
</xsl:variable>

then


	select="count(document(saxon:node-set($addxml)/ME/@id)/ME/FOURN/DEVOIR"/>

is the number you are after, if you are not using saxon replace
saxon:node-set by your system's node set extension function.

david

--
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

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


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


Current Thread