1) Process fileA using the identity transform
2) In the <record> template, key into fileB using the title, where the
key matches "record" and uses "title"
3) Copy the name and url elements, or *[not(self::title)]
cheers
andrew
2009/11/16 Mak, Lucas Wing Kau <makw(_at_)mail(_dot_)lib(_dot_)msu(_dot_)edu>:
I want to merge two XML files (i.e. fileA & fileB below) by matching the
values in their <title> elements and grabbing everything from fileA, but only
the <url> element from fileB.
fileA
<collection>
<record>
<title>abc</title>
<name>peter</name>
</record>
<record>
<title>def</title>
<name>jack</name>
</record>
<record>
<title>ghi</title>
<name>john</name>
</record>
</collection>
fileB
<collection>
<record>
<title>abc</title>
<date>11/23/2008</date>
<url>http://no.com</url>
</record>
<record>
<title>ghi</title>
<date>12/12/2007</date>
<url>http://hello.com</url>
</record>
<record>
<title>cmyk</title>
<date>10/12/2006</date>
<url>http://hi.com</url>
</record>
</collection>
Output XML
<collection>
<record>
<title>abc</title>
<name>peter</name>
<url>http://no.com</url>
</record>
<record>
<title>ghi</title>
<name>john</name>
<url>http://hello.com</url>
</record>
</collection>
How I can do it? I am using XSLT 1.0 since I am more familiar with 1.0
(though my processor also support 2.0)
Thanks in advance.
Wing (makw(_at_)msu(_dot_)edu)
--~------------------------------------------------------------------
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>
--~--
--
Andrew Welch
http://andrewjwelch.com
Kernow: http://kernowforsaxon.sf.net/
--~------------------------------------------------------------------
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>
--~--