[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Types and Context
- From: Jeni Tennison <firstname.lastname@example.org>
- To: Gavin Thomas Nicol <email@example.com>
- Date: Tue, 22 May 2001 19:27:22 +0100
> Not necessarily. I could write an XPath expression that matches
> anything with that has a <first> and <last> element inside of a
> <name> element, for example. The main difference is really one of
> convenience. Personally, if I was *that* worried about convenience,
> I'd probably define a "my:type" attribute, set it to "person", and
> then match on that. I can see few cases, outside of very
> data-centric applications, where the above would be useful.
OK. I looked at the DocBook XSLT stylesheets by Norm Walsh to see if I
could find an example from a *document-centric* application to
persuade you, and very quickly came across the expression:
(in common/common.xsl template matching question|answer in
label.content mode, used to set the $lparent variable)
In a DocBook schema, presumably all of these elements would be of the
same type, and the XPath could be simplified to:
(or ancestor::*[xs:type('docbook:section')] for simplicity)
This kind of path isn't uncommon in the DocBook stylesheets. I don't
know if Norm has considered adding type attributes to all the DocBook
elements to make his life easier...
> My main concern with the above is that it is *complicated*. Match
> patterns are already fairly expensive/hard to optimize. Adding in
> schema support will make them even harder to optimise... especially
> in the face of the conflicting incrementality goals for XSLT 2.0.
> While some very smart people *will* be able to optimize the match
> patterns, it will be beyond the scope of what most people are
> capable of, and what most people need.
I agree with you. I know it sounds as though I'm arguing for schema
support in XSLT/XPath 2.0, but actually I'm only arguing that there is
a benefit to it, as an XSLT author, not necessarily that this benefit
outweighs the cost to the development of XSLT as a whole.
The impact of adding schema awareness to XSLT processors would really
depend on the XML Schema processors that are available to provide
PSVIs to the XSLT processors. If they're fairly small, have a good API
to the PSVI, and are available in lots of languages, then the cost
shouldn't be too high. However, I think that's a big *if*, and that
concerns me - XSLT has benefited tremendously from having loads of
free, open-source processors available, and I'd hate for that to end
because they have difficulties implementing schema support.