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

Fwd: Re: Comparison evaluation in XPath (resend)

Subject: Fwd: Re: Comparison evaluation in XPath (resend)
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 15 Mar 2003 10:46:02 -0500
xpath comparison operators

Date: Fri, 14 Mar 2003 11:43:44 -0500
To: xsl-lists@xxxxxxxxxxxxxxxxxxxxxx
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Subject: Re:  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@xxxxxxxxxxxxxxxxxxxx
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



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.