[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: Mukul Gandhi <gandhi.mukul@xxxxxxxxx>
Date: Thu, 8 Sep 2005 22:19:45 +0530
how to update xml value
Hi Shailesh,
   Please try this XSLT stylesheet

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">

<xsl:output method="xml" indent="yes" />

<xsl:variable name="update" select="document('update.xml')" />

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

<xsl:template match="test2">
   <test2><xsl:value-of select="$update//test2[../@id =
current()/parent::*/@id]" /></test2>
</xsl:template>

</xsl:stylesheet>

Regards,
Mukul

On 9/8/04, Shailesh <shailesh@xxxxxxxxxxxx> wrote:
> Hi All,
>
> I have source.xml:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <test>
> <chapter>
> <test1 id="0000001">
>        <test2></test2>
> </test1>
> </chapter>
> </test>
>
> And update.xml contains:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <beta>
> <test1 id="0000001">
>        <test2>ABCD</test2>
> </test1>
> </beta>
>
> 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.
>
>
> Can anyone help me out.
>
> Thanks,
> Shailesh

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.