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

Re: document function and counting

Subject: Re: document function and counting
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Wed, 01 Aug 2001 22:58:16 +0100
counting xml items
How about something like this?

<untested>
...
<xsl:for-each select="document('foo-1.xml')//item |
document('foo-2.xml')//item" >
	<xsl:value-of select="position()" /> 
	<xsl:copy-of select="." />
</xsl:for-each>
...
</untested>

Francis.

Christine Donica wrote:
> 
> I am trying to use the document function to pull in the result trees of
> other documents and then I want to number things across the entire new
> document in one pass.
> 
> For example say I have a file called master.xml which contains uri's to
> other documents called foo1.xml and foo2.xml.  Say foo1.xml and foo2.xml
> each contain a list of <item> tags.
> 
> I want the output of the transformation to be a document which contains
> all of the <item>s of both foo1.xml and foo2.xml AND I want to number them
> continuously from the top to the bottom.  I want to do this in one pass of
> a stylesheet.
> 
> I can pull foo1.xml and foo2.xml into the output file using document().
> Also, if all of the items are already in the same document I can easily
> number them using the <xsl:number> tag.  However, it is not possible to do
> both in the same run of the stylesheet because xsl:number does not seem to
> have access to the elements in main.xml and either foo1.xml or foo2.xml at
> the same time. So I can reach my goal if I write two stylesheets and run
> them one after each other, but I don't want to do that.
> 
> Alternatively, I have tried using parameters to pass a number into the
> item template.  However, I don't know how to get this information from the
> point where the template matches an <item> in foo1.xml to a point where it
> matches <item> in foo2.xml.  That is, I cannot pass parameters up the
> tree.
> 
> Could someone please explain how I should do this?  Or, is it even
> possible?
> 
> Thank you so much for your time.
> 
> Sarah Coppin
> 
>  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

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.