Subject: Re: [xsl] "if-condition-return something" idiom : is it possible in XSLT ? From: "Kerry, Richard richard.kerry@xxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 17 Jun 2014 15:37:03 -0000 |
"think of XSLT as a functional language" XSLT is the only language I've ever used that is described as Functional, so I don't know what impact that has generically. I am, as you can all see, now learning a bit more about the implications. "There's no concept of an "early return" from a mathematical function" Indeed not. "nor from an XSLT one." That was the core of my question. How to express a problem which I can easily express in that way in a form suitable for XSLT. Appreciatively, Richard. ________________________________________ From: Liam R E Quin liam@xxxxxx [xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx] Sent: 16 June 2014 21:12 To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] "if-condition-return something" idiom : is it possible in XSLT ? 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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] "if-condition-return some, Wolfgang Laun wolfga | Thread | [xsl] Re: "if-condition-return some, Kerry, Richard richa |
Re: [xsl] Re: "if-condition-return , Kerry, Richard richa | Date | Re: [xsl] Re: "if-condition-return , Wolfgang Laun wolfga |
Month |