xsl-list
[Top] [All Lists]

Re: [xsl] XPath that returns nothing

2011-09-28 04:01:54
On 27/09/2011 09:42, Andrew Welch wrote:
On 26 September 2011 22:17, Olivier Lefevre<lefevrol(_at_)yahoo(_dot_)com>  
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"/>

incidentally () is the _only_ expression that is guaranteed to return nothing and to be safe in a schema aware xslt2 processor. Other expressions that may statically be determined empty may raise an error.

david

________________________________________________________________________
The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. ________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--