[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Things that make you go Hmmmm!

Subject: Re: [xsl] Things that make you go Hmmmm!
From: "Abel Braaksma (Exselt)" <abel@xxxxxxxxxx>
Date: Sat, 29 Mar 2014 16:30:54 +0100

On 29-3-2014 16:13, Ihe Onwuka wrote:
> Up to the language designer whether they want to issue a warning about
> parameters are ignored. Up to the programmer to investigate if he
> doesn't get back what he expected - that is an inherent part of the
> discipline of programming.

I have to say that I am very glad that we have little or no properties
of instructions that are meaningless and that do nothing more than
showing a warning. If a language would have such instructions, I think
it would be very hard to work practically with such a language, as you
would constantly have to look up the manual or spec to find the
situations where a certain attribute is meaningless and when it is not.

That said, even in XSLT there are quite some situations where you can do
something meaningless. For instance, you can set a default collation for
your entire stylesheet, but never use any function or instruction that
actually uses collations. Most likely, you do not even get a warning.

Likewise, you can do <xsl:apply-templates select="/ancestor::foo" />. A
processor might issue a warning about this, but doesn't have to. Maybe
you intentionally selected nothing.

Similarly, we often get questions about intermittent and unexpected
output of text. Usually the result of applying templates without a
matching template. Again, a processor might warn about this, but usually
does not, because it is the default behavior (arguably one of the most
debated ones). Indeed, it is up to the programmer to investigate this,
but it is also up to the language designer to make meaningful
constructs. If a construct never ever does anything, it has no place in
the language, or in any language for that matter. Luckily, I find that
with the plethora of languages I have had the pleasure to work with,
that most languages do not provide such meaningless constructs.

Of course, we can agree to disagree here, but my point is simple: keep
it simple and don't add stuff that serves no purpose and (might) only
confuse users. If that sacrifices orthogonality, so be it. It is an
important concept, but not at the cost of usability and applicability.


Abel Braaksma
Exselt XSLT 3.0 processor

Current Thread