That seems to easy Ken. In terms of processing optimization, is there any reason to prefer one formulation over the other (meaning, is it possible to predict how XPath processors will be able to optimize this type of expression)?
Thanks, E. ---- Eliot Kimber, Owner Contrext, LLC http://contrext.com On 7/19/15, 10:09 AM, "G. Ken Holman" <[email protected] on behalf of [email protected]> wrote: >How about: > > $a1//b except $a1//a//b > >. . . . . . Ken > >At 2015-07-19 06:33 -0500, Eliot Kimber wrote: >>Given this starting document: >> >>Let $doc := >><root> >><a id="a1"> >> <b>b1</b> >> <b>b2</b> >> <c> >> <b>b6</b> >> </c> >> <a id="a2"> >> <b>b3</b> >> <b>b4</b> >> <a id="a3"> >> <b>b5</b> >> </a> >> </a> >> </a> >> </root> >> >>I want to find all the <b> elements descending from <a id="a1"> but not >>within nested <a> elements: >> >><b>b1</b> >> <b>b2</b> >> <b>b6</b> >> >> >>This gives me the correct answer: >> >> >>let $a1 := $doc/a >>let $bsInA1 := $a1//b[not(./ancestor::a = ($a1//a))] >> >> >>My question: With Xpath 3.1, is there a better way to express this query? >>I looked at the new outermost() and innermost() operators but I didn't >>see >>a way to apply them to this problem. >> >>Thanks, >> >>Eliot >> >>---- >>Eliot Kimber, Owner >>Contrext, LLC >>http://contrext.com >> >> >> >>_______________________________________________ >>[email protected] >>http://x-query.com/mailman/listinfo/talk > > >-- >Check our site for free XML, XSLT, XSL-FO and UBL developer resources | >Free 5-hour lecture: http://www.CraneSoftwrights.com/links/video.htm | >Crane Softwrights Ltd. http://www.CraneSoftwrights.com/q/ | >G. Ken Holman mailto:[email protected] | >Google+ profile: http://plus.google.com/+GKenHolman-Crane/about | >Legal business disclaimers: http://www.CraneSoftwrights.com/legal | > > >--- >This email has been checked for viruses by Avast antivirus software. >https://www.avast.com/antivirus > >_______________________________________________ >[email protected] >http://x-query.com/mailman/listinfo/talk > _______________________________________________ [email protected] http://x-query.com/mailman/listinfo/talk
