W3C home > Mailing lists > Public > public-qt-comments@w3.org > April 2004

Re: [XSLT 2.0] Why doesn't XSLT have an <xsl:else> element?

From: Dimitre Novatchev <dnovatchev@yahoo.com>
Date: Fri, 2 Apr 2004 13:09:10 -0800 (PST)
Message-ID: <20040402210910.93408.qmail@web41102.mail.yahoo.com>
To: Jim Melton <jim.melton@acm.org>
Cc: Oliver Becker <obecker@informatik.hu-berlin.de>, public-qt-comments@w3.org

Jim,

--- Jim Melton <jim.melton@acm.org> wrote:
> 
> First, let me say that I agree with Oliver that it wouldn't be difficult
> to have syntax that avoids the dangling-else problem.  In addition,
there
> are many languages that resolve the dangling-else by means of clear, 
> easy-to-remember rules.

But these languages are not with xml syntax. One of the goals of having
xml syntax is that the structure must make understanding the meaning quite
easy -- not to rely on other, less intuitive and visual rules.

This is how I understand the question of Mike Kay:

"How would you associate the <xsl:else> with the <xsl:if>? Perhaps by
wrapping both of them in an <xsl:choose>?"


> 
> Second, with regard to "why not use xsl:choose", I have to admit that I 
> start off writing the content of a template quite often with an xsl:if, 
> thinking that I only need to do something if the test succeeds and do 
> nothing if it fails.  Shortly after writing this, I suddenly realize
> that I do need to something if the test fails, so I am forced to 
> restructure my > code in a slightly inconvenient way to replace what 
> could have been simple if...then...else with a 
> choose ...when...otherwise.../choose.  

>Of course,
> 
> having to do that is not a disaster, but it is inconvenient and 
> annoying. 

If this were often the case, I'd use exclusively xsl:when and not xsl:if

As or the inconvenience of rewriting xsl:if to xsl:chose with an xsl:when
child, this is certainly so. As is writing code in any programming
language without the support of a good IDE.

> Besides, there was no reason to be so hostile to the submitter of the 
> original question.  It seemed rude to just keep informing him that he's 
> just too dumb to realize that the "right" decision was already made and
> he 
> shouldn't be questioned such received wisdom.

I was surprised that my message might be referred to as hostile and I
deeply apologize if someone could think so. The use and existence of
xsl:if and xsl:choose is something very basic in XSLT. My personal
expectations from this list and the work of the WG is to see discussions
of really new and useful features of XSLT 2.0. For me a discussion about
adding an xsl:else certainly does not fall into that category.

Best regards,

Dimitre Novatchev



__________________________________
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway 
http://promotions.yahoo.com/design_giveaway/
Received on Friday, 2 April 2004 16:10:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:45:19 UTC