Re: [xsl] Avoiding boneheaded mistakes in XSLT?

Subject: Re: [xsl] Avoiding boneheaded mistakes in XSLT?
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 29 Dec 2010 07:21:29 -0500
At 2010-12-29 07:49 +0000, Dave Pawson wrote:
On Tue, 28 Dec 2010 23:13:01 +0000
Michael Kay <mike@xxxxxxxxxxxx> wrote:

> I think the main reason for the problem is that an XSLT/XPath program
> makes many references to names (of elements and attributes) which do
> not have to be declared, so that using an incorrect name is not an
> error (either static or dynamic), but rather results in an XPath
> expression that simply selects nothing.

I guess no one would do that deliberately?
Yet the rec and implementations don't provide any error | warning
about it?

Of course they do not and they cannot without schema awareness. If I'm not using schema awareness, and an element <x> is optional in my vocabulary and my user doesn't include <x> in their data, it is in no way a warning or error situation that the selection selects nothing.

Only with schema awareness would the processor know to tell the stylesheet writer they are addressing an element or attribute, say named <X>, that is not in the vocabulary and would, therefore, never be selected or found.

Without schema awareness, implementations are doing the correct thing by not reporting any errors or messages in this regard.

I hope this helps.

. . . . . . . . . . Ken

Contact us for world-wide XML consulting & instructor-led training
Crane Softwrights Ltd.
G. Ken Holman                 mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Legal business disclaimers:

Current Thread