With a schema-aware stylesheet, provided you include
enough type information in your code, Saxon will give you warning messages where
it can infer that a path is "invalid" in the sense that it will never select
anything (I sometimes refer to these as "void" paths - they are legal, but
essentially useless, rather like writing $x+0).
Saxon's type-checking in XSLT is essentially at the
level of a template rule. So if the type of the matched element is known,
everything selected downwards from there will be checked. For example if you
then Saxon will tell you if a foo/bar element cannot
contain a baz element.
This won't work if you don't import a schema, and it
won't work if you simply say match="foo", because that will match any element
named foo whether or not it is a valid instance of the element declaration
foo in the schema. (I'm thinking of introducing a diagnostic mode in which you
can get warnings even if you only said match="foo", but it's not there
The other thing to be aware of is that if you write
your stylesheets like this, the source document presented to the stylesheet must
be validated against the schema.
If you're concerned with performance, the effect is
mixed: the transformation will generally run faster, but sometimes the speed-up
is not enough to compensate for the extra cost of doing schema validation on the
Schema-aware processing is only available with Saxon
I would like to continue thread from here: http://groups.google.pl/group/microsoft.public.xsl/browse_thread/thread/640a3889d78ab3a1.
I want to werify that XPath expressions in my xslt documents are
valid. Now, with SaxonHE when I exectute following
There is no error (in PDFGenerator.xslt I put
XPath expression with fileld that does not exist in xml)
detect such a