Compile that with a schema-aware processor (Saxon SA in this
case) and you are told:
"The complex type root does not allow a child element named wrong;"
You don't even have to validate any input, because the match
pattern contains the type it knows that "wrong" is not a
child of <root>...
fantastic :)
I think this means you can enjoy the benefits of the paths in
your XSLT being checked against the schema _without_ being
forced to validate the input each time... which is a huge benefit.
Yes, it is a huge benefit, especially when you write stylesheets for complex
industry schemas that require path expressions a mile long. Three caveats:
(a) you only get this compile-time checking if you are careful to declare
your types, e.g. the types of variables and parameters, and to define match
patterns in terms of schema-element() or element(N,T).
(b) compile-time type checking is a feature of the processor, not of the
language. The other schema-aware processor doesn't do it...
(c) you DO still have to validate the input when you run the stylesheet,
because otherwise your pattern element(root, root) won't match the input.
Michael Kay
http://www.saxonica.com/
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--