For all such tasks you should start with the identity transformation template
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
and then add templates for nodes that need special treatment, for instance
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="test/@title"/>
would copy everything unchanged but would delete all title
attributes of test
elements.
Or
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="test">
<change><xsl:apply-templates select="@*|node()"/></change>
</xsl:template>
<xsl:template match="test/@title">
<xsl:attribute name="title"/>
</xsl:template>
should implement your second requirement. If you still have problems then post minimal but complete samples allowing us to reproduce the problem.