Re: [xsl] Avoiding boneheaded mistakes in XSLT?

Subject: Re: [xsl] Avoiding boneheaded mistakes in XSLT?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 29 Dec 2010 15:43:02 -0800
 > Incorrect warnings are always very irritating, so this is not
> something to be done lightly, but it's something I've wanted to attempt for
> a long time.
>
> Michael Kay
> Saxonica


Please, don't.

There's nothing more frustrating than finding tons of useless and
annoying messages that make it virtually impossible to dig out the
useful ones. I'd certainly stop using Saxon if it behaved like that.

I also hope that XQSharp's developers are listening now ...

--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.



On Wed, Dec 29, 2010 at 3:36 PM, Michael Kay <mike@xxxxxxxxxxxx> wrote:
>
>> Even without schema awareness/context, surely the processor can
>> tell when an xpath expression will result in zero match?
>>
>
> No, it's very rarely possible.
>
> For example, consider
>
> <xsl:template match="books">
> <xsl:value-of select="book[1]/authour"/>
> </xsl:template>
>
> Even if you have a schema telling you that the children of books can
include
> book but the children of book can't include authour, this doesn't tell you
> that this path will necessarily return nothing - because there is no way
you
> can know that every books element that the stylesheet processes will be
> valid against this schema.
>
> In fact it's quite common for a stylesheet to create intermediate results
> that (deliberately) aren't valid against the schema for the input or output
> document.
>
> It would however be possible to make a guess that this is wrong, and issue
a
> warning. Incorrect warnings are always very irritating, so this is not
> something to be done lightly, but it's something I've wanted to attempt for
> a long time.
>
> Michael Kay
> Saxonica

Current Thread