Hi I have a question about whitespace stripping in Saxon. I created this simple stylesheet:

 

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

       <xsl:output method="xml" version="1.0" encoding="UTF-8"/>

       <xsl:template match="node() | @*">

             <xsl:if test="self::text() and normalize-space(.)=''">

                    <xsl:message terminate="no">Warning: whitespace encountered: '<xsl:value-of select="."/>'</xsl:message>

             </xsl:if>

             <xsl:copy>

                    <xsl:apply-templates select="node() | @*"/>

             </xsl:copy>

       </xsl:template>

</xsl:stylesheet>

 

It’s just an identity transformation, which warns anytime it encounters a whitespace text node. On Saxon 6.5.2/Crimson or Aelfred and also on other configurations including Xalan/Xerces Xalan/Crimson, etc. I keep getting warnings (the xml file is very simple and contains xsl:space=”default” in the root and nowhere else). Is this the expected behavior? Shouldn’t whitespace nodes be stripped before transformation occurs (spec. - sec. 3.4)?

BTW, MSXML does behave the way I would expect, but maybe it’s them who aren’t conformant.

 

thanks

 

Ytai  Ben-Tsvi

C T I Squared