xsl-list
[Top] [All Lists]

RE: [xsl] A smarter choose operation XSL 1.1

2009-06-11 04:27:07
 
select="(1.0, 1.7, 2.25, 3.0)[count(($opt.one, $opt.two, 
$opt.three)[.])+1]"

The strange predicate [.] selects items in the sequence 
that are true.

Would someone expand on this oddity please?
I'm guessing 'true' in this case is the xslt version of 'true'...
I.e. non-empty?

It will select all items in the sequence than have an effective boolean
value of true (other than numbers, because [] is overloaded for numbers). In
this case the items in the sequence are booleans, so it will select the
true() values and reject the false() ones.

How does that relate to
($opt.one, $opt.two, $opt.three)[.]  please?

You can read it as

($opt.one, $opt.two, $opt.three)[. = true()]

if you prefer. But writing X=true() when X is a single boolean is always the
same as writing X.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay  


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--