|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: matching elements by name and type to detect inval
> 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/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








