Re: [xsl] XPath expression that generates false plus a message?

Subject: Re: [xsl] XPath expression that generates false plus a message?
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Wed, 25 May 2011 09:28:53 +0100
On 25/04/2011 10:38, Costello, Roger L. wrote:
Hi Folks,

I want an XPath expression that is an if-then-else:

      If (condition) then
          true()
     else
         false()

Apart from the use of "If" rather than "if", this is a valid XPath expression.


If "condition" is satisfied then return true, else return false. However, in addition to returning false, I want to return a message.

Here's an example that illustrates what I want to do:

----------------------------------------------------------------------
if (xs:time(start) gt xs:time(end)) then
      true()
else
      trace(false(), 'Hey, the meeting ends before it begins!')
----------------------------------------------------------------------

Unfortunately, that doesn't work. I guess the "else" part is actually returning true.

Your guess is wrong. The else part will always return false.

Please supply a complete working example that demonstrates the problem.

Michael Kay
Saxonica

Current Thread