check out Oliver's merge.xsl at
http://www.informatik.hu-berlin.de/~obecker/XSLT/#merge
hth,
Manos
jithendarl wrote:
Hi friends,
I am new to xslt. I am facing a problem in merging 2 xml files into 1.
I am suceeded in that but my next requirement is that duplicate rows
should come only once. Can anyboy help me in removing in duplicates?
Here I am attaching the zip file which contains the files related to this one.
input : delivery.xml this file contains names of files to be
merged(i.e a.xml and b.xml)
XSLT : merge.xsl
I am also enclosing the files to be merged(i.e a.xml and b.xml)
This is very urgent for me.
Thanks in advance.
Jithu
Input File A
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>
<nodes>
<node>1</node>
<node>2</node>
<node>4</node>
</nodes>
</product>
</products>
Input File B
<?xml version="1.0" encoding="UTF-8"?>
<products>
<product>
<nodes>
<node>2</node>
<node>3</node>
</nodes>
</product>
</products>
Input File Delivery
<?xml version="1.0" encoding="UTF-8"?>
<delivery sender="provisioner">
<subscription id="" time.stamp="">
<file.delivery.info>
<files level="product" total.files="2">
<file name="b.xml"/>
<file name="a.xml"/>
</files>
</file.delivery.info>
</subscription>
</delivery>
XSL File
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!--
-->
<xsl:output method="xml" indent="no" encoding="UTF-8"/>
<!--
-->
<xsl:template match="/">
<products>
<product>
<nodes>
<xsl:for-each
select="delivery/subscription/file.delivery.info/files/file">
<!--xsl:message terminate="no">
<xsl:value-of
select="@name"/>
</xsl:message-->
<xsl:for-each
select="document(./@name)">
<xsl:apply-templates
select="*"/>
</xsl:for-each>
</xsl:for-each>
</nodes>
</product>
</products>
</xsl:template>
<xsl:template match="node">
<xsl:for-each select=".">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:template>
</xsl:transform>
Jithu
--~------------------------------------------------------------------
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>
--~--
--~------------------------------------------------------------------
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>
--~--