If i apply the following xslt
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" indent="yes"/>
<xsl:template match="*">
<xsl:copy><xsl:apply-templates/></xsl:copy>
</xsl:template>
<xsl:template match="b/*">
<xsl:copy><xsl:apply-templates/></xsl:copy>
</xsl:template>
<xsl:template match="text()">text</xsl:template>
</xsl:stylesheet>
on the following xml
<?xml version="1.0"?>
<a>
<b></b>
</a>
the output is
<a>
text
<b></b>
text
</a>
What i don't get: All the empty text-nodes between the elements get processed except the empty text-node inside the element b. I don't see any difference on how the child elements of a and b are processed.
There is no empty text node inside the b
element, it is an empty element that has no child nodes at all. On the other hand, the a
element has three child nodes, the first is a text node with whitespace (at least a line break and some space or tab characters), the second is the b
element, the third is a text node with white space (at least a line break).
Also where did you get that result with the indentation of the text
output you have shown? At http://xsltransform.hikmatu.com/94hvTyG I get the output <a>text<b></b>text</a>