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

RE: Concatenating multiple input documents into a sing

Subject: RE: Concatenating multiple input documents into a single node-set
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 12 May 2004 16:51:00 +0100
xslt 2.0 multiple input documents
> I want to concatenate all of the nodes in a RELAX-NG schema (which is 
> comprised of multiple included files) into a single node-set. 
>  I've tried 
> something like this:
> 
> <xsl:variable name="collection">
>    <xsl:for-each select="//rng:include">
>       <xsl:copy-of select="document(@href)" />
>    </xsl:for-each>
> </xsl:variable>
> 
> but I only get one node in the resulting variable.  

The above should work. It should give you a result tree fragment. When you
convert this to a node-set using the xx:node-set() extension (or implicitly,
in XSLT 2.0), the value of the variable is a document node whose children
should include all the document elements of the selected documents. So the
value of the variable is indeed one node.

What are you actually doing with this data? I suspect you don't need to copy
the nodes at all, only to select them.

In fact you don't need the for-each, because the document() function can
process multiple URIs in a single call. I suspect that all you need is:

<xsl:variable name="collection" select="document(//rng:include/@href)"/>

Michael Kay

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.