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

Re: Get value from update.xml and stored in source.xm

Subject: Re: Get value from update.xml and stored in source.xml(update source.xml)
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Thu, 08 Sep 2005 10:56:19 +0200
Re:  Get value from update.xml and stored in  source.xm
Hi,

Tempore 10:39:52, die 09/08/2004 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Shailesh <shailesh@xxxxxxxxxxxx>:


Using xslt 1.0 I have to extract the value of <test2> which is in <test1 id="0000001"> of update.xml and put it in <test2> which is in <test1 id="0000001"> of source.xml.

This should updates the <test2> of source.xml without any other changes.

Try applying the following stylesheet to 'source.xml'.


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*"/>

<xsl:output method="xml" />

<xsl:variable name="update" select="document('update.xml')"/>
<xsl:key name="id" match="*" use="@id"/>

<xsl:template match="*[@id]">
	<xsl:variable name="id" select="@id"/>
	<xsl:copy>
		<xsl:apply-templates select="@*" />
		<xsl:for-each select="$update">
			<xsl:copy-of select="key('id',$id)/*"/>
		</xsl:for-each>
	</xsl:copy>
</xsl:template>

<xsl:template match="node()|@*">
	<xsl:copy>
		<xsl:apply-templates select="node()|@*" />
	</xsl:copy>
</xsl:template>

</xsl:stylesheet>

--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
Deserta faciunt et innovationem appelant

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.