I am working on a project which modifies xml documents. I want to modify either a node value or an attribute value. I was able to do that if I specify that it's a node or an attribute value that I want to modify. Modifying node value in xsl:
<xsl:template match="XPath/text()">newValue</xsl:template>
Modifying attribute value in xsl:
<xsl:template match="XPath">
<xsl:attribute name="attributeName">newValue</xsl:attribute>
</xsl:template>
But I want to modify the values without specifying that it is a node or an attribute. For example here is a short xml:
<example>
<test>
<node attrName="oldAttrValue">
oldNodeValue
</node>
</test>
</example>
I would like to modify the "attrName" attribute value or the "node" node value without specifying which. Is this somehow possible, maybe from an XPath?
Thank you.