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

RE: xpath 2.0 expressions

Subject: RE: xpath 2.0 expressions
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Thu, 3 Jan 2002 13:10:51 -0000
RE:  xpath 2.0 expressions
> After Mike and Jeni's comments re brevity [complexity?]
> I find it unusual to mandate the else clause in
> the if, then, else.

It's a conditional expression rather than a conditional instruction; with a
conditional instruction, doing nothing in the else branch is a reasonable
default, but with conditional expressions, most languages require both
branches to be explicit. It would certainly be possible to return () (the
empty sequence) if the else branch is omitted, but I don't know whether this
would really be a good idea. In the cases where it's what you want you can
usually rewrite it as a predicate:

Instead of
  for $i in //item return (if (exists($i/@value)) then $i/@value else ())
  for $i in //item[@value] return $i/@value

Mike Kay

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Current Thread


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.
First Name
Last Name
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.