Re: [xsl] Avoiding boneheaded mistakes in XSLT?

Subject: Re: [xsl] Avoiding boneheaded mistakes in XSLT?
From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>
Date: Mon, 03 Jan 2011 12:02:43 -0500
Hi again,

On 12/30/2010 8:48 AM, Michael Kay wrote:
Producing warnings for constructs that could be correct comes into a
different category. Saxon has always produced some such warnings for
things that are obviously wrong, even though legal (for example @A/@B),
and I think there is plenty more scope to be smarter. For example, If
someone writes book/isbn when the schema (or indeed the instance)
contains book/@isbn, I think the probability that this is incorrect is
sufficiently high to justify a warning, provided it can be suppressed at
user option.

Personally I'm very sympathetic to Dimitre's caution about all this. Saxon now warns when, for example, one tries to select "text()" from an attribute context. Fair enough. But this sometimes leads to unwanted messages when one has done this on purpose. For example, maybe you have written a Schematron that matches on attributes, and the built-in Schematron implementation (which happens to be Saxon running an XSLT) ends up throwing this error. And the framework in which you are running Schematron doesn't give you access to the switches for the instance of Saxon that runs it....


I certainly concur that the warning message should be turned off by default. But remember not everyone running XSLT has the means to tweak these settings. Of course, as far as Saxon is concerned, Mike gets to make the judgement call. But personally I'm of the mind that this particular kind of error is one you learn to watch out for, and if you know enough to control all the switches and settings for your tools, you probably also know enough to diagnose and fix it without the tool's help.

The contrapositive of this is "if you don't know enough to diagnose and fix this problem without a tool's help, you probably also don't know how to control the switches and settings for your tools."

Cheers,
Wendell

--
======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
  Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================

Current Thread