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

RE: A smarter choose operation XSL 1.1

Subject: RE: A smarter choose operation XSL 1.1
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Thu, 11 Jun 2009 09:26:31 +0100
RE:  A smarter choose operation XSL 1.1
> > 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  

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.