I think this is very difficult. Here is a stylesheet that will uncomment all comments in a rather "hackish" way that works with msxml2:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="comment()">
<xsl:value-of disable-output-escaping="yes" select="normalize-space(.)"/>
</xsl:template>
</xsl:stylesheet>
To do this properly you'd have to specify a bit more:
How do you decide which commments to remove? Is it all or those matching a certain pattern?
What are the rules for changing the attributes?
If this is just a one-off stylesheet that needs to be run against many files and there is just one comment that needs to be removed and the contents changed then:
Code:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="node()|@*"/>
</xsl:copy>
</xsl:template>
<xsl:template match="comment()">
<abc prop1="3" prop2="2"/>
</xsl:template>
</xsl:stylesheet>
would do it.
--
Joe (
Microsoft MVP - XML)