[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Schema aware transformations

Subject: RE: Schema aware transformations
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 22 Jun 2005 14:58:07 +0100
xml schema find unreachable elements
> Is it feasible for a schema aware processor to detect unreachable
> templates?

If they're defined by name alone, then at present no, because there's always
the possibility that the stylesheet will create an untyped temporary tree
and apply templates to it. (But there's always scope for optional warnings
that detect such situations).

To get the real benefit of schema-aware XSLT processing, you really need to
start defining match patterns in terms of schema-declared elements and
types, for example

<xsl:template match="schema-element(invoice)/delivery-address/postcode">

Once you start doing this, you get a lot more of your errors detected at
compile time, because the XSLT processor knows when analyzing the body of
the template what the types of the context node (and its children, etc) are.
For example one of my users the other day had deep within a template a call


and got a compile-time type error because the expected type of the first
argument of my:function was not the same as the type of the match pattern. 

This kind of thing is so useful that I'm hoping in due course to add an
option that declares a stylesheet to be "fully-typed" - that is, it won't
accept any untyped data, and the compiler can then assume that any element
name in the stylesheet corresponds to an element name in the schema. (The
details aren't easy, which is why this option isn't in the spec.)
> Ultimately I really want to start using SA processing but I can't find
> the justification just yet...

It's a fair investment to get started (time learning the ropes, and time
establishing schemas for all your documents) but once you're over the curve,
it makes the debugging cycle a completely different experience - instead of
wrong or absent output, you get accustomed to expecting early error
messages, often at compile time.

Michael Kay

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.