'Bug in SAXON? It generates two adjacent text nodes for a leaf element

On the xml-dev list Michael Kay wrote:

In the XDM model the content of the Test element is a single text node. XDM does not allow two adjacent text nodes.

I believe SAXON uses the XDM model.

Consider this leaf element:

<Test>
    abc<!-- aaa -->def
</Test>

I ran SAXON with this XSLT program:

<xsl:template match="Test">
    <xsl:message>count = <xsl:value-of select="count(text())"/></xsl:message>
</xsl:template>

The output is:

count = 2

That is not correct as it says the leaf element contains two adjacent text nodes, which clearly contradicts what Michael said on the xml-dev list. Do you agree?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source