Name
[2.0] <xsl:document>
Allows you to create a new document node. This element
is useful for validating the document node against a schema. The
document node created by <xsl:document>
is not meant to be
serialized (written to disk); if that’s what you want to do, use
<xsl:result-document>
instead.
Category
Instruction.
Required Attributes
None.
Optional Attributes
- [2.0 – Schema]
type
Defines the datatype of the root element node created by this element. To validate a document node, it must have as its children a single element node, no text nodes and zero or more comment and processing instruction nodes. If the document node doesn’t have this structure, the XSLT processor throws an error.
The
type
andvalidation
attributes are mutually exclusive.- [2.0 – Schema]
validation
Defines how the value of the new element will be validated. The
validation
attribute has four values:strict
,lax
,preserve
, orstrip
. To validate a document node withstrict
orlax
, the document node must have as its children a single element node, no text nodes, and zero or more comment and processing instruction nodes. If the document node doesn’t have this structure, the XSLT processor throws an error if you usestrict
orlax
.validation="strict"
means that the XSLT processor looks in all the declared schemas for an element declaration (<xs:element>
) with the same name as the single element node that is a child of this document node. It is a fatal error if the processor can’t find a matching<xs:element>
. Assuming the ...
Get XSLT, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.