Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - I need to copy XML with one change to an attribute >Thread Next - Re: I need to copy XML with one change to an attribute Re: I need to copy XML with one change to an attributeTo: NULL Date: 9/1/2008 12:59:00 PM
khalil_mi@h... wrote:
> I need the output to be exactly the same as the input xml with one
> change to the attribute value documentStatus="ACCEPTANCE" to be
> documentStatus="TEST">
Use the identity transformation template and add a template for the
attribute:
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0"
xmlns:eanucc="http://example.com/ns1">
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="eanucc:despatchAdvice/@documentStatus">
<xsl:attribute name="{name()}"
namespace="{namespace-uri()}">TEST</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
Note that I made the namespace http://example.com/ns1 up for the
example, you need to replace that with the real namespace URI your XML
input binds the prefix eanucc to.
--
Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
