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

Re: [xsl] When to use conditional constructions?

Subject: Re: [xsl] When to use conditional constructions?
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sun, 30 Mar 2014 09:44:52 -0700

Sure, this can be done.

And for if .. then .. else :

( exprResultIf [condition],  exprResultElse [not(condition)] )  [1]

I believe it should be possible to write a tool that takes as input a
given XSLT transformation (and as part of this a given XPath
expression) and converts it to equivalent code, in which any
conditionals are eliminated.

We could also add a good code-formatter that takes the output of the
first tool and converts it to "well-formatted code".

The last tool should be highly configurable, as there are different tastes.


On Sun, Mar 30, 2014 at 9:29 AM, Imsieke, Gerrit, le-tex
<gerrit.imsieke@xxxxxxxxx> wrote:
> On 30.03.2014 18:11, Dimitre Novatchev wrote:
>> I believe it is impossible to eliminate "if-expressions" in XPath
>> because we don't have templates there. It's a pity.
> Does this qualify for an if-expression-less syntax?
> let $a:=4
> return ('result1'[$a=1], 'result2'[false()], 'result3'[4=$a],
> 'result4'[true()])[1]
> b 'result3'

Dimitre Novatchev
Truly great madness cannot be achieved without significant intelligence.
To invent, you need a good imagination and a pile of junk
Never fight an inanimate object
To avoid situations in which you might make mistakes may be the
biggest mistake of all
Quality means doing it right when no one is looking.
You've achieved success in your field when you don't know whether what
you're doing is work or play
To achieve the impossible dream, try going to sleep.
Facts do not cease to exist because they are ignored.
Typing monkeys will write all Shakespeare's works in 200yrs.Will they
write all patents, too? :)
I finally figured out the only reason to be alive is to enjoy it.

Current Thread