Environment: XSLT 1.0
Expected output: Only the text node for level 2 element
Actual output: Both level1 and level2 text outputs
xsl
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="text"/>
<xsl:template match="/*">
<xsl:apply-templates select="/data/section1" />
</xsl:template>
<xsl:template match="level2">
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
xml
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="SelectingAndMatching.xslt"?>
<data>
<section1>
<level1>hello world 1</level1>
<level2>unlocked achievement level 2</level2>
</section1>
<section2>
<product1></product1>
<product2></product2>
<product3></product3>
</section2>
</data>