|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Copy one element from one xml file to another
Hi:
I have xml1 based on xsd1 and xml2 based on xsd2. I want to copy the value of the attribute "name" of the "transport" element from xml1 to xml2.
Consider xml1:
<?xml version = '1.0' encoding = 'UTF-8'?>
<applet locale="en" ...................>
<transport name="jrmp"/><transport name="codebase"/>
....
...
...
</applet>
----------------------------------------
Consider xml2:
<disco:configuration xmlns:disco=......................... xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=............... >
....
....
<plus helpSet="help">
<transport name="jrmp"/>
<transport name="http"/>
</plus>
</disco:configuration>
-----------------------------------------
I noticed the following xsl would do the job in the sense, it outputs the correct value --
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:disco="http://www.oracle.com/discoverer/configuration"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" encoding="ISO-8859-1" indent="yes" />
<xsl:template match="transport">
<xsl:call-template name="copy"/>
</xsl:template>
<xsl:template name="copy">
<xsl:copy>
<xsl:apply-templates select="@*" mode="copy" />
<xsl:apply-templates/>
<xsl:value-of select="text()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
-------------------------------------------------
How can I thereafter replace the value for the transport element in xml2 with the values I have from the above transform?
Thanks, Nishi.
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








