Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: Question about union operator (|) >Thread Next - Re: Question about union operator (|) Re: Question about union operator (|)To: NULL Date: 9/2/2007 9:38:00 PM In article <D6adnVtO6Od7U0fbnZ2dnUVZ_jSdnZ2d@c...>, Joe Kesselman <keshlam-nospam@c...> wrote: >By the way, if you're implementing XPath, watch out for the definition >of //. (I'm still trying to find someone who can explain to me why this >operation was explicitly defined as a top-down scan rather than as a >traditional postorder tree walk. Both are perfectly reasonable >operations, but I would expect the latter to be more commonly used and >hence a better meaning for the shorthand // operator. And having to >constantly remind folks that it *isn't* just document-ordered >descendant:: has been an ongoing nuisance.) I'm not sure I understand your description, but if you mean "why is it defined as descendant-or-self::node()/ rather than descendant::", it's so that expressions like //p[1] mean "all paragraphs that are first children" rather than "the first paragraph". I believe this was considered more common in formatting, and practical to implement as a match pattern (predicates in match patterns can only occur after child:: or attribute:: steps, so position() only requires examination of siblings, rather than the whole tree). -- Richard -- "Consideration shall be given to the need for as many as 32 characters in some alphabets" - X3.4, 1963. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
