RE: [xsl] Using 'validation' in xsl:result-document

Subject: RE: [xsl] Using 'validation' in xsl:result-document
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 10 Nov 2009 22:13:13 -0000
> Can anyone tell me what exactly the options (strict, lax, strip,
> preserve)  for attribute validation under element 
> <xsl:result-document> mean?

The spec says *exactly* what they mean, but I expect you really want to know
in plain language what they mean.

strict means the system must find an element declaration in a schema for the
named element at the root of your result document, and must validate the
result document against that declaration, throwing an error if it's found to
be invalid.

lax means the system should try to find an element declaration matching the
root element name; if it finds one, it must perform validation against this
element and throw an error if it's invalid; if it doesn't find one, then it
doesn't perform validation (except that it keeps looking for schema
declarations that match elements further down the tree).

preserve means output the result tree with type annotations as they are
(some branches of the tree might have been validated while they were being
constructed, other branches might be untyped).

strip means remove all type annotations from the result tree.

> 
> When I use validation=strict, I get XTTE1550 error in XML Spy.

That is most likely to mean that your result tree is invalid against the
schema. It could also mean that the schema is invalid, or that it does not
contain an element declaration for the outermost element of your result
document.

To debug this, if the error messages aren't helpful, you might find it
useful to output the result document with validation="strip", and then
validate it against the schema "by hand".

Michael Kay
Saxonica

Current Thread