[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Whitespace,xml:space,xsl:strip-space


Subject: Whitespace,xml:space,xsl:strip-space
From: Paul_Martin@xxxxxxxxxxxxxx
Date: Fri, 23 Jun 2000 19:15:08 +1000

I am a bit  confused by whitespace handling, so I apologise for the detailed queries.
Thanks very much in advance.

Am I correct in saying that :-

1. the default parser behaviour (ie. when have not set the parser NOT to include whitespace or overidden ignorableWhitespace with a noop) is for all whitespace, ie. leading and trailing whitespace, and also carriage returns etc. to be passed to the application. The latter becoming whitespace-only text nodes.

2. the effect of xml:space on whitespace-only text nodes produced by the parser is that when xml:space ="preserve" then the IsIgnorableWhitespace() method of these whitespace-only text nodes will return false indicating that they should not be discarded by the application; and when xml:space="default" then the method will return false indicating that can be discarded by the aqpplication.

3. the xml:space attribute has no effect on leading or trailing whitespace, eg.
<schedule>
<scheduleNumber xml:space="default">    123456789</scheduleNumber>
</schedule>
and
<xsl:template match="schedule" >
<fo:block><xsl:value-of select="scheduleNumber"/></fo:block>

generates the following in the output file (note with no explicit setting of xsl:strip-space or xsl:preserve-space) :-
<fo:block>     123456789</fo:block>

4. xsl:strip-space can be used to strip leading and trailing whitespace in a text node, but will not affect the white space ONLY text nodes.

5. Could someone please provide an example(s) of the above, including where
exactly to put the xsl:strip-space and xsl:preserve elements.



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread