RE: [xsl] Work with two xmls and combine them using xsl

Subject: RE: [xsl] Work with two xmls and combine them using xsl
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 14 May 2008 10:43:13 +0100
Your example documents aren't well-formed (no outer element) so you'll have
to adapt this code. But try something like this:

<xsl:template match="/">
<result>
  <xsl:apply-templates select="* | document('Second.xml')/*"/>
</result>
</xsl:template> 

so when you process the document node of first.xml, it causes the outermost
elements of both first.xml and second.xml to be processed.

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

> -----Original Message-----
> From: sudheshna iyer [mailto:sudheshnaiyer@xxxxxxxxx] 
> Sent: 14 May 2008 10:34
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] Work with two xmls and combine them using xsl
> 
> I have the feed from two different sources.I need to combine 
> both of them and produce a common list.
> 
> 
> How do I read from two xml files in xsl and produce the list 
> of events?
> For eg: 
> 
> First.xml
> 
> <?xml version=1.1>
> <eventname>first-eve</eventname>
> <eventtitle>first-title<eventtitle>
> ..
> 
> Second.xml
> <?xml version=1.1>
> <eventname>second-eve</eventname>
> <eventtitle>second-title<eventtitle>
> ..
> 
> Now after applying xsl transformation of both of the above 
> xmls, I should get:
> 
> EventName: 	first-eve
> Event Title:	first-title
> 
> EventName: 	second-eve
> Event Title:	second-title

Current Thread