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

Re: reccursive sum ?

Subject: Re: reccursive sum ?
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 2 Mar 2004 11:15:40 GMT
Re:  reccursive sum ?
		<xsl:variable name="ThisMEid">
			<xsl:value-of select="@id"/>
		</xsl:variable>

don't use xsl:variable with content unless your really need that
you can just go
		<xsl:variable name="ThisMEid" select="@id"/>
which is more efficient and more flexible as teh variable then holds an
attribute rather than a result tree fragmment.
In this case you don't need a variable at all, just go
<xsl:with-param name="MEid" select="@id"/>

Similarly you don't need MEfile you can just go

	<xsl:value-of
	select="count(document(concat($Meid,'.xml'))/ME/FOURN/DEVOIR"/>

If you could change your input to

<LISTE-ME>
	<ME id="0010.xml"/>
	<ME id="0045.xml"/>
	<ME id="0152.xml"/>
</LISTE-ME>

then you would not need teh concat above, just use

	<xsl:value-of
	select="count(document($Meid)/ME/FOURN/DEVOIR"/>


could use the following to get the total

	select="count(document(ME/@id)/ME/FOURN/DEVOIR"/>

But unfortunately using concat produces a string which stops document()
automatically taking the union of all the documents in the node set.

In XSLT1 the easiest way if you can not change your input format is
probably to do one pass into a variable that changes all the 
<ME id="0010"/> in to <ME id="0010.xml"/>
then use your processor's node-set() extension function to
apply templates to this new input as above.

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


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.