Re: interfaces for XSLT 2.0 templates

Dear all,

I agree with Dimitre that the XSLT language should be kept as simple as possible. But I don't think this should occur at the cost of dependency on proprietary tools, or the creation of verbose and error-prone code structures. If a few new statements in a language make the resulting code simpler and shorter, that's a good thing.

In this regard, I'm proud to announce an early alpha version of an extension to XSLT 1.0 that allows OO features including interfaces and inheritance. For now I'm calling it XSLT' (pronounced not-quite-XSLT!). The sources and a full description are available at Sourceforge:

https://sourceforge.net/projects/xsltp/

I am creating the technology to assist in my own XSLT projects, but I believe it is of interest to those concerned with the further development of the XSLT language.

XSLT' transforms a stylesheet containing inheritance, parameter overriding, and interfaces into pure XSLT 1.0. This implies that the two language forms are mathematically equivalent, and that an inheritance/interface-based stylesheet can be read as a traditional stylesheet without loss of information.

So a processor that separates the act of reading a stylesheet from the act of executing the stylesheet, only needs to modify the first phase (reading) while the second phase (execution) would not be impacted by the XSLT' language change.

Briefly, here is what XSLT' does:

1. INTERFACES
=============
XSLT' allows templates to declare they use a given interface, in which case they inherit a set of parameters from the interface. Templates can redefine the parameter default values locally, and can also define additional local parameters.

Obviously, if the interface definition is altered, the change propogates to all templates using the interface.

Template calls can also declare the use of an interface, in which case the call provides a sequential list of parameters which are resolved to name-value pairs by the XSLT' script.

Interfaces are treated as compositions of globally defined parameters. Inheritance between interfaces is forbidden by XSLT' (I felt this would make the language too opaque).

2. INHERITANCE
==============

XML Schema provides inheritance features, so it can be appealing to create stylesheets that use inheritance as well. For example, a supertemplate can do complex processing, and this logic can be inherited by subtemplates.

XSLT' defines inheritance as the copying of variable definitions, and parameter definitions, to child templates. The child template can use the parent variable without having to explicitly define the variable.

Why is this inheritance? Variables represent properties of a given context. Child templates can inherit these properties.

I feel inheritance is an essential feature as XML document types evolve into greater complexity - consider such examples as OMG's XMI, or the W3C's SVG.

3. ASSERTS
==========

Asserts were proposed on this list some time ago by ?????????????????????. As asserts are so trivial to implement, and as they correspond mathematically to pure XSLT 1.0, XSLT' also provides an xslp:assert element.

Best regards,

Agnes Clarke
www.agslin.net

Received on Wednesday, 2 October 2002 03:30:07 UTC