xsl-list
[Top] [All Lists]

Re: [xsl] Merging multiple documents and combining their nodes

2007-06-13 07:16:16
Hi Michael,

Thanks for the suggestion. My team's currently limited to XSLT 1.0,
using Apache Xalan-J 2.6.0.

Regards,
Mark


On 6/13/07, Michael Kay <mike(_at_)saxonica(_dot_)com> wrote:
Are you constrained to XSLT 1.0? If you can use 2.0, it's simple:

<xsl:variable name="docs" select="document(('file1.xml', 'file2.xml',
'file3.xml'))"/>
<xsl:variable name="comps" select="$docs/components/component"/>

<components>
 <xsl:for-each-group select="$comps" group-by="@name">
   <component name="{current-grouping-key()}"
              description="{(_at_)description}">\\\
     <xsl:copy-of select="current-group()/*"/>
   </component>
 </xsl:for-each-group>
</components>

Michael Kay
http://www.saxonica.com/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--