[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: The pipe '|' operator: Does it mean Or or Union?
That makes sense, especially with the fact the 'or' returns a Boolean. The color commentary is welcomed. :) -----Original Message----- From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Wendell Piez Sent: Wednesday, January 14, 2004 1:12 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: The pipe '|' operator: Does it mean Or or Union? At 12:15 PM 1/14/2004, Jeff wrote: >kakridge@xxxxxxxxxxxxx wrote: >>I've noticed the the Muenchian method uses '|' and that everyone refers >>to this as a Union. However, I also read that this >><xsl:template match="foo | foobar"> >>means to match the foo OR foobar elements. Does the definition of the >>operator change based on the application? > >Matching "foo | foobar" gives you the union of the set of all foo with the >set of all foobar. You can read it as "OR", but it's still a union >operator. XPath has a separate "or" operator, but that's not the same thing. It may also help to recall the rationale for matching: my node matches a pattern if there is another node in the document from which my node can be retrieved, using the given pattern as an XPath expression. (This would make for chaos, except of course not all XPath location paths are allowed as patterns -- only some of the ones that look "down"). Since all foo and all foobar elements have parent nodes, any of them can be reached, from somewhere, using the XPath "foo | foobar". In other words, the pattern matches any node in the union set of foo and foobar elements. (The "or" operator returns a Boolean, so it can't be used in a pattern -- apart from inside predicates -- since it doesn't return nodes at all.) Hm, I seem to be offering lots of color commentary today.... Cheers, Wendell ====================================================================== 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 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
|