SchemaAware Processing in XSLT 2 0 Michael Kay
- Slides: 8
Schema-Aware Processing in XSLT 2. 0 Michael Kay Prague 2005
Contents • Motivation – why do it? • What’s different about it? • Demonstration 2
High-level Rationale • Stylesheets are written with a particular schema in mind • Schema knowledge ought to be useful – at design time – at compile time – at run time • Potential benefits: – error detection (and prevention) – optimization 3
W 3 C XML Schema • Highly complex specification – not universally liked – many features, but not always the ones you want • Widely supported by big vendors and users • More than just validation – Defines data types – Supports data binding 4
Schemas and Stylesheets • Stylesheet can import a schema – makes the types available for use within the stylesheet at compile time – e. g. match=“schema-element(invoice)” • Source documents can be validated – gives each node a type annotation • Result documents can be validated – checks correctness of output – typed input to next step in pipeline 5
Schema-Awareness is Optional • Optional for the vendor – there is an XSLT “basic conformance level” that excludes schema-aware features • Optional for the user – you can process unvalidated (untyped) data – you can mix typed and untyped data 6
Demonstration GEDCOM 5. 5 previous example GEDCOM 5. 5 in XML Schema GEDCOM 6. 0 XHTML this example 7
Conclusions • Writing schema-aware stylesheets is different – a different way of thinking – a different experience of development and debugging • Definite benefits in early error detection and diagnosis • Optimization benefits still speculative 8