Date: Fri, 14 Mar 2003 11:43:44 -0500
To: xsl-lists(_at_)lists(_dot_)mulberrytech(_dot_)com
From: "G. Ken Holman" <gkholman(_at_)CraneSoftwrights(_dot_)com>
Subject: Re: [xsl] Comparison evaluation in XPath
At 2003-03-13 16:56 -0800, Gregory Murphy wrote:
Looking at the grammar for XPath, it appears that the comparison and
equality operators are left-associative. So,
x > y > z
should be evaluated as if it were
( x > y ) > z
How then should the value be obtained? If evaluation is performed at each
branch of an LALR(1) parse of an XPath expression, then an expression like
3 > 2 > 1
would be reduced first to
true > 1
which would evaluate to false. But shouldn't the answer be true?
Whenever ">" or "<" is used in the operator, both operands are cast to
numbers. The number() function on "true()" returns the number 1 ... and 1
is not greater than 1.
I hope this helps.
.............. Ken
--
Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO
North America: June 16-20, 2003
G. Ken Holman mailto:gkholman(_at_)CraneSoftwrights(_dot_)com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/s/bc
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list