[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Re: [XSL] Implicit Predicate Casting
At 2007-10-14 12:56 +0200, Alain wrote:
Because when the predicate is not of type "number", then the argument is cast to type "boolean". A non-empty string is cast to boolean true, so all members are exposed. A result tree fragment or temporary tree always casts to boolean true, so all members are exposed.So that would fall under XPath "shortcut" expressions and tricks! Yes, the implied comparison operator makes the expression result a boolean. So in my example, the value being the same for every node (nothing depends on the node in Yes. I find it a very "dangerous" shortcut if you do [something] relying on the type of 'something' There are a few other examples in XPath. to imply position()= if it is what you meant. Yes. And even for that... if you are a bit tired and wrote ['2'], being confused to where you have The boolean casting happens on the end result of the expression ... other casting is going on within the expression. So, if I ever run a class as you seem to do Ken, (Note I license my training material to other teachers around the world http://www.CraneSoftwrights.com/training/licensed.htm if you were interested in doing so yourself) I will advise to *always* make position() Yes that would work because of the casting that goes on *in* the expression, not with the result of the expression: when the comparison operator is between dissimilar data types (in this example a number and a string), the string is converted to a number before the comparison. Because <xsl:value-of/> acts on only the first of the addressed nodes in document order. All three are being addressed, but only the first is being returned.Ok! So that falls under differences between XSLT1.0 and 2.0 Yes The XSL2.0 norm is much more accurate when such errors happens. It even gives an It is *very* helpful. Chapter 17 of XSL1.0 (Conformance) says : I agree. Not reporting reportable problems is not helpful. Developers using software that "helps" them by forgiving problems will then trip over their users problems after deployment. Human brain is complicated... I got it right for not(not(a=b) and not(a!=b)) meaning both sequence a and b are not empty, Sorry ... you lost me there. Are you referring to a comparison returning false if either operand is the empty sequence? This catches students using "a!=b" and getting false (and thinking that means a and b are equal which they are not because of an empty operand) instead of "not(a=b)" which when false means that they are in fact equal. but couldn't get a grip on that XPath implied thing, which is a very basic thing ! Instructors should remember the formal specifications are written for implementers more so than for users, thus making an excellent market for books and training material. So, you've got to drill down very deeply to understand what's really happening. As is so often the case for specifications. Training material can present the concepts differently to help students understand. . . . . . . . . . . . . . Ken -- Comprehensive in-depth XSLT2/XSL-FO1.1 classes: Austin TX,Jan-2008 World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training 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) Male Cancer Awareness Jul'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|