Re: [xsl] Avoiding boneheaded mistakes in XSLT? (to warn or not to warn)

Subject: Re: [xsl] Avoiding boneheaded mistakes in XSLT? (to warn or not to warn)
From: Emmanuel Bégué <eb@xxxxxxxxxx>
Date: Thu, 30 Dec 2010 09:25:17 +0100
I hope I won't get hit on the head with a stick for doing this, but
I'd like to weight in on the "warning" side.

Greg's arguments revolve around the fact that an instance of a schema
that allows optional elements may or may not have those elements; when
optional elements are not present, it's not an error of any kind, so
"reporting" it would be misleading at best and extremely annoying at

And of course, when there is no schema then everything is
possible/optional, so there is even less rationale to report anything.

But, there are many cases where one is processing an XML file that has
been produced specifically for the job at hand; it's the only
representation of its kind and there will never be "other instances"
of the same structure.

Therefore the transforms are specific to this one instance, and they
are written so that every template should actually select something
(because they will not be executed against another instance, and if
they don't match something this time around then they are entirely

Wouldn't it be useful to have a switch that said "for this transform,
I expect all my templates to select something; please tell me at the
end of the transformation the ones that were not run"?

Or is it more the job of an IDE?


Current Thread