[XSL-LIST Mailing List Archive Home]
RE: [xsl] Concatenating multiple input documents into a single node-set
Subject: RE: [xsl] Concatenating multiple input documents into a single node-set|
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Wed, 12 May 2004 16:51:00 +0100
> 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)" />
> 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)"/>