I need to copy a complete xsl-file but change the specific value of the @select attribute of a specific variable.
My pseudocode idea:
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="variable[@name='Name']">
<xsl:attribute name="select">
<xsl:value-of select="'new value'"/>
</xsl:attribute>
</xsl:template>
To be perfectly clear; how do I select the variable element in a match statement?
It might be possible with [CDATA] but i prefer a more functional solution.
I am constricted to xslt 1.0.
Any ideas?
>Solution :
how do I select the variable element
Like any other element that’s in namespace, you select it by its qualified name, i.e. a name that includes a prefix bound to the element’s namespace and its local name – for example:
<xsl:template match="xsl:variable[@name='Name']/@select">
<xsl:attribute name="select">new value</xsl:attribute>
</xsl:template>
Note that your attempt, even if it did work, would remove the name attribute.