This style sheet:
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:my="...">
<xsl:param name="PARAM_MODE" select="1"/>
<xsl:template match="@*|node()" name="identity">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="my:sometag">
<xsl:if test="$PARAM_MODE!=1">
<xsl:call-template name="identity"/>
</xsl:if>
</xsl:template>
<xsl:template match="my:sometag2">
<xsl:if test="$PARAM_MODE!=2">
<xsl:call-template name="identity"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
With this input:
<root xmlns="...">
<sometag />
<sometag2 />
<someothertag />
</root>
Conclusion:
<root xmlns="...">
<sometag2></sometag2>
<someothertag></someothertag>
</root>
Note that if you want a simplified syntax , http://www.w3.org/TR/xslt#result-element-stylesheet :
, node. (. 7.1.1 ). xsl: stylesheet , ; /.
, , .
EDIT: .
, ... test.xsl URI:
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<root
xmlns="..."
xmlns:my="..."
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xsl:version="1.0">
<PARAM_MODE>1</PARAM_MODE>
<xsl:if test="document('')/my:root/my:PARAM_MODE!=1">
<sometag />
</xsl:if>
<xsl:if test="document('')/my:root/my:PARAM_MODE!=2">
<sometag2 />
</xsl:if>
<someothertag />
</root>
Runnig ( PI. , fn:document() ...), :
<root xmlns="..." xmlns:my="...">
<PARAM_MODE>1</PARAM_MODE>
<sometag2 />
<someothertag />
</root>
, , :
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="PARAM_MODE" select="1"/>
<xsl:template match="@*|node()" name="identity">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="*[preceding-sibling::node()[1]
/self::comment()[starts-with(.,' remove ')]]">
<xsl:if test="$PARAM_MODE != substring-after(
preceding-sibling::comment()[1],
'PARAM_MODE=')">
<xsl:call-template name="identity"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
:
<root xmlns="...">
<sometag2></sometag2>
<someothertag></someothertag>
</root>
user357812