Hi,
Now I have one final question. I want to add an attribute/value to the
xml tree only if that attribute does not exist anywhere in
the document
source tree.
Is there a way to do that in XSLT?
<xsl:template match="the-node-to-add-the-attribute-to">
<xsl:copy>
<xsl:if test="not(//@the-attribute)">
<xsl:attribute name="the-attribute">the value</xsl:attribute>
</xsl:if>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
Cheers,
Jarno