[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: "if-condition-return something" idiom : is it pos

Subject: Re: "if-condition-return something" idiom : is it possible in XSLT ?
From: "Liam R E Quin liam@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 16 Jun 2014 20:12:01 -0000
Re:  "if-condition-return something" idiom : is it  pos
On Mon, 2014-06-16 at 13:00 +0000, Kerry, Richard richard.kerry@xxxxxxxx
wrote:
> I tend to view (*) xsl:choose as similar to C's "switch", which needs
> to do a single calculation to work out which branch to run.
> (*)  I may well be wrong in this.....

xsl:choose is like a sequence of C if statements in practice, and is
what yu want for your C++-like example.

But I think it better to think of xsl:choose in the mathematical sense,
e.g.

 A := f(x)
       0 when x <= 1
      17 when x <= 7
       A(x - 1) . A(x - 2) when x^2 + 1 is prime
      31x / 7 otherwise

That is, I prefer to think of XSLT as a functional language in which one
is describing the end result rather than as a procedural language with
loops and returns.

There's no concept of an "early return" from a mathematical function,
nor from an XSLT one.

Liam


-- 
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.