[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Removing duplicates in Merge

Subject: Re: Removing duplicates in Merge
From: Emmanouil Batsis <Emmanouil.Batsis@xxxxxxxxxxx>
Date: Tue, 26 Jul 2005 11:11:24 +0300
xslt remove duplicate rows
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.