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

Re: XPath that returns nothing

Subject: Re: XPath that returns nothing
From: Andrew Welch <andrew.j.welch@xxxxxxxxx>
Date: Wed, 28 Sep 2011 11:11:13 +0100
Re:  XPath that returns nothing
On 28 September 2011 10:01, David Carlisle <davidc@xxxxxxxxx> wrote:
> On 27/09/2011 09:42, Andrew Welch wrote:
>>
>> On 26 September 2011 22:17, Olivier Lefevre<lefevrol@xxxxxxxxx>  wrote:
>>>
>>> What is the best XPath expression that is guaranteed to return nothing?
>>> (best in the sense of simplest, always works and costs as little as
>>> possible to evaluate). I was hoping it'd be the empty string but that
>>> seems forbidden.
>>
>> Out of interest, why do you ask?
>>
>>
>>
>
> Usual reason for wanting this is as a default value for a parameter so you
> can go
>
> <xsl:param name="x" select="()"/.
> ...
>
> <xsl:value-of select="$x/a/b"/>

...so it's basically just making something explicit that is otherwise
implied?   I don't think I'd ever use it.

The part of the spec that talks about this:

------
If an optional parameter has no select attribute and has an empty
sequence constructor, and if there is no as attribute, then the
default value of the parameter is a zero length string.

[ERR XTDE0610] If an optional parameter has no select attribute and
has an empty sequence constructor, and if there is an as attribute,
then the default value of the parameter is an empty sequence. If the
empty sequence is not a valid instance of the required type defined in
the as attribute, then the parameter is treated as a required
parameter, which means that it is a non-recoverable dynamic error if
the caller supplies no value for the parameter.
------



--
Andrew Welch
http://andrewjwelch.com

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.