The saxon:require-well-formed attribute
This attribute affects the handling of result documents that contain multiple top-level elements or top-level text nodes. The W3C specifications allow such a result document, even though it is not a well-formed XML document. It is, however, a well-formed external general parsed entity, which means it can be incorporated into a well-formed XML document by means of an entity reference.
saxon:require-well-formed is available, with
values "yes" or "no". The default is "no". If the value is set to "yes", and a SAX destination
(for example a
JDOMResult, or a user-written
ContentHandler) is supplied to receive the results of the transformation, then Saxon will report an
error rather than sending a non-well-formed stream of SAX events to the
This attribute is useful when the output of the stylesheet is sent to a component (for example an XSL-FO
rendering engine) that is not designed to accept non-well-formed XML result trees.
Note also that namespace undeclarations of the form
xmlns:p="" (as permitted
by XML Namespaces 1.1) are passed to the
startPrefixMapping() method of
ContentHandler only if
undeclare-prefixes="yes" is specified on