SAXONICA

Saxon Documentation
Full Contents
About Saxon
Changes in this Release
| Version 8.7 (2006-02-24)
| Version 8.6.1 (24 November 2005)
» | Version 8.6 (3 November 2005)
| Version 8.5.1 (26 August 2005)
| Version 8.5 (2 August 2005)
| Version 8.4 (4 April 2005)
| Version 8.3 (11 February 2005)
| Version 8.2 (21 December 2004)
| Version 8.1.1 (8 October 2004)
| Version 8.1 (24 September 2004)
| Version 8.0 (1 June 2004)
Conditions of Use
Using XSLT 2.0
Using XQuery
Handling Source Documents
XML Schema Processing
The XPath API
Saxon on .NET
Extensibility
Saxon Extensions
Sample Saxon Applications
The Saxon SQL Extension
XSLT Elements
XPath 2.0 Expression Syntax
Function Library
Standards Conformance

# Building source documents

To conform with the W3C Data Model specification, an incompatible change has been introduced in this release: by default, "ignorable whitespace" is stripped from source documents before a query or transformation commences.

If the document has a DTD, then ignorable whitespace is whitespace appearing between the child elements of an element that is declared to have element-only content. Such whitespace is always reported as such when a validating parser is used, but there appear to be differences between parsers as to whether it is reported when not validating.

If the document has a schema, then ignorable whitespace is a whitespace text node appearing as a child of an element that has element-only content.

If there is no DTD and no schema, then whitespace is never ignorable.

The presence of an `xml:space="preserve"` attribute has no effect on this process.

This whitespace stripping is additional (and prior) to any whitespace stripping requested using `xsl:strip-space` in an XSLT stylesheet. It occurs only when a document is built from a StreamSource or SAXSource.

The default behavior can be overridden from the command line. The `Transform` and `Query` commands have three new options: `-snone` strips no whitespace, `-signorable` strips ignorable whitespace, and `-sall` strips all whitespace text nodes.

It is also possible to override the default behavior when using the `doc()` or `document()` function, if query URI parameters are enabled, by adding the parameter `strip=no` to the URI.

Next