RE: [xsl] XML/XSL free editor (eclipse plug-in, if possible)

Subject: RE: [xsl] XML/XSL free editor (eclipse plug-in, if possible)
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 9 Nov 2004 14:16:40 -0000
> I'm looking for a new XSLT IDE that integrates the new schema aware
> functionality of 2.0; for example underlining any Xpath's I write that
> aren't 'possible' (looking for the correct word there) 
> according to the
> given schema.  

I'm afraid you're a little bit ahead of the bleeding edge here. But it will
come!

Saxon 8.1 took the first step in this direction by tracking statically what
the type of the context item is for each instruction. This is clearly a
prerequisite. You now get a compile-time error if, for example, you do
xsl:apply-templates at a point in the code where the context item is known
to be an atomic value, or where it is known to be undefined. The next step,
of checking whether a path expression is "possible" according to the schema,
still lies ahead.

The XSLT spec, incidentally, doesn't make "impossible" path expressions an
error. (I sometimes call them "void" path expressions, but the term isn't in
the spec.) It's more likely, as you suggest, that this will lead to warnings
of some kind. Making it an error is difficult because given a template rule
such as <xsl:template match="x">, the compiler cannot be sure that this is
only intended to match elements that are valid according to the schema
declaration of x. Even if you're explicit and say match="schema-element(x)",
it's a little bit draconian to reject <xsl:copy-of select="@*"/> or
<xsl:apply-templates/> simply because it's known that a valid x has no
attributes/children: after all, you might be writing code to anticipate a
future change.

(And there are lots of XSLT 1.0 stylesheets that use the void path
expression /.. quite deliberately...)

Michael Kay

Current Thread