Re: [xsl] Avoiding boneheaded mistakes in XSLT?

Subject: Re: [xsl] Avoiding boneheaded mistakes in XSLT?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Thu, 30 Dec 2010 13:53:42 +0000
Still ignoring schema.
My supposition is that *for the xml instance being processed*
either the expression will or will not return a non-empty
sequence. Hence there is a possible error.
In this case either the first book child has an author child or not.
Surely that information is available Mike?


The problem is that if someone writes


if (@version = "2.0") ...

and there is no @version attribute, it's very likely that the semantics of the vocabulary are that an absent version attribute is to be treated as if @version="1.0". So a warning that there is no version attribute would be inappropriate here. The situation where the schema doesn't allow a version attribute is different.

Michael Kay
Saxonica

Current Thread