I've seen similar questions, but it is still unclear to me. I don't want the "n1" namespace to appear in the attribute of the node in the output file. But I had to create the "n1" namespace in the xslt file in order to get xpath to work. Thank you.
XSLT:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:n1="http://www.spicefactory.org/parsley"
xmlns="http://www.spicefactory.org/parsley"
>
<xsl:output method="xml" indent="no"/>
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="n1:object[@type='mytype1']">
<object type="mytype2">
<xsl:apply-templates select="node()"/>
</object>
</xsl:template>
EXCERPT FROM OUTPUT XML FILE:
<object type="mytype2" xmlns:n1="http://www.spicefactory.org/parsley">
Use exclude-result-prefixes
attribute on <xsl:stylesheet>
element.
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:n1="http://www.spicefactory.org/parsley"
xmlns="http://www.spicefactory.org/parsley"
exclude-result-prefixes="n1"
>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With