hi,
I have a xml in which I want to replace the element(s) value with XSLT
Xml message
<Message>
-
<case>
-
<party1>
-
<!-- there are other elements -->
-
<notes id="1">abcd</notes>
-
<notes id="2">abcd</notes>
-
<notes id="3">abcd</notes>
-
-----
-
-
<notes id=n>some text</notes>
-
</party1>
-
-
<party2>
-
<!-- there are other elements -->
-
<notes id="1">abcd</notes>
-
<notes id="2">abcd</notes>
-
<notes id="3">abcd</notes>
-
-----
-
-
<notes id=n>some text</notes>
-
</party2>
-
-
<client1>
-
-
<!-- there are other elements -->
-
<notes id="1">abcd</notes>
-
<notes id="2">some text</notes>
-
<notes id="3">some text</notes>
-
-----
-
-
<notes id="n">some text</notes>
-
-
</client1>
-
-
<client2>
-
-
<!-- there are other elements -->
-
<notes id="1">some text</notes>
-
<notes id="2">some text</notes>
-
<notes id="3">some text</notes>
-
-----
-
-
<notes id="n">some text</notes>
-
-
</client2>
-
-
-
</case>
-
</Message>
From the above xml I want to copy all the elements to another xml but, I want to modify the values <notes> element to some other value.
I have managed to construct a XSL like this.
XSL :
- <?xml version='1.0' encoding='ISO-8859-1'?>
-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
-
<xsl:output method="xml" indent="yes"/>
-
<xsl:strip-space elements="*"/>
-
<xsl:key name="nvalue" match="notes" use="text()"/>
-
-
<xsl:template match="node()">
-
<xsl:copy>
-
<xsl:copy-of select="@*"/>
-
<xsl:apply-templates select="node()"/>
-
</xsl:copy>
-
</xsl:template>
-
-
<xsl:apply-templates select="notes"/>
-
-
<xsl:template match="notes">
-
<notes>replace notes</notes>
-
</xsl:template>
-
-
</xsl:stylesheet>
please help me with the XSL
Many thanks in advance