2

Setting expand-text="yes" in an XSLT stylesheet appears to cause extra whitespace to be emitted in the output XML. For example, this stylesheet:

<xsl:stylesheet 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    expand-text="no"
    version="3.0">
    <xsl:template match="/">
        <xsl:text>A</xsl:text>
        <xsl:text>B</xsl:text>
    </xsl:template>
</xsl:stylesheet>

produces the output AB. But if I change it to expand-text="yes" then it produces A B.

Can anyone help explain this behavior? Is it by design? I am using Saxon-PE 9.6.0.7.

Thanks, Josh.

Martin Honnen
  • 160,499
  • 6
  • 90
  • 110
joshp123
  • 67
  • 4
  • I have tried the example with `expand-text="yes"` in Exselt and the output is `AB`. I am not sure which result is correct although https://www.w3.org/TR/xslt-30/#stylesheet-stripping does not seem to indicate any relation between the whitespace stripping and `expand-text`. – Martin Honnen Mar 13 '16 at 09:37
  • Looks like a bug to me. – Michael Kay Mar 13 '16 at 11:02
  • 1
    Saxon 9.7 gets this right, Saxon 9.6 got it wrong. It was evaluating the xsl:text element as a string rather than as a text node. – Michael Kay Mar 13 '16 at 18:01

1 Answers1

2

Just for completeness: this was a bug in Saxon 9.6 that is fixed in 9.7.

Michael Kay
  • 156,231
  • 11
  • 92
  • 164