I have an XML document, and I want to change the values for one of the attributes.
First I copied everything from input to output using:
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
And now I want to change the value of the attribute "type"
in any element named "property"
.
The top two answers will not work if there is a xmlns definition in the root element:
All of the solutions will not work for the above xml.
The possible solution is like:
I had a similar case where I wanted to delete one attribute from a simple node, and couldn't figure out what axis would let me read the attribute name. In the end, all I had to do was use
@*[name(.)!='AttributeNameToDelete']