xsl-list
[Top] [All Lists]

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

2011-05-25 03:29:05
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

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

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [xsl] XPath expression that generates false plus a message?, Michael Kay <=