[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: RE: unbelievable often asked question
As a footnote to what Mike B. says about "|": strictly speaking it's the
union operator even when appearing in match patterns. This makes sense if
you think about match patterns in the way the spec describes:
"A node matches a pattern if the node is a member of the result of evaluating the pattern as an expression with respect to some possible context; the possible contexts are those whose context node is the node being matched or one of its ancestors" [XSLT 5.2] Admittedly that's more than a mouthful: but it makes sense if you think about it that the union operator could be used in such a context to get an effective "match this node *or* this other node". Note that the Boolean "or" is not so useful (and in fact the spec has just stipulated that "An expression that is also a pattern always evaluates to an object of type node-set", and an "or" operator always evaluates to a Boolean). What's worse (or better :-): in practice, the union operator and the "or" operator can give effectively the same results, as in select="*[red|green]" vs. select="*[red or green]". In the first case, an element "*" is selected if the node set of "child::red|child::green" (union of red children and green children) evaluates to Boolean true() for that element, which is the case if this set contains any members (which will be so if the element has either any red element *or* any green element children). In the second, an element "*" is selected if the node set containing red children is evaluated as Boolean true() (i.e. there are any red children) *or* if the node set containing green children is evaluated as Boolean true(). (I guess the mathematicians can say whether this is some distributive property or what.) While this is nice, it's also understandable why it's easy to get mixed up about what's really going on with "|". It's not really an "or" at all. Cheers, Wendell At 01:38 PM 1/2/2003, Mike wrote: Hubert Holtz wrote: > I often visit tutorial-sites to get my informations (and now this great > mail-list) and there was no "and", only a | for or. ====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ====================================================================== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|