W3C home > Mailing lists > Public > public-qt-comments@w3.org > November 2003

Re: DM expressing until-like queries in XPath 2.0

From: David Carlisle <davidc@nag.co.uk>
Date: Thu, 27 Nov 2003 14:01:20 GMT
Message-Id: <200311271401.OAA15334@penguin.nag.co.uk>
To: marx@science.uva.nl
Cc: public-qt-comments@w3.org



something like

.//*
  [@l='no' and not(ancestor::*[
      count(.|current()/descendant::*)=
          count(current()/descendant::*)]/@l='no')]

would restrict the ancestors to be descendants of the current node but
that requires the xslt current() function (and if you're using xslt you
could write the whole thing much more simply using xslt conditionals.


in pure xpath2 I suppose it's something like

for $here in .
  return
  $here//*[@l='no' and (every  $a in ancestor::*[@l='yes'] satisfies 
      (some $d in $here/descendant-or-self::*  satisfies $d is $a ))]


for each descendent with @l=no check that all its ancestors with l=yes
are descendents of the current node.


-- 
http://www.dcarlisle.demon.co.uk/matthew

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
Received on Thursday, 27 November 2003 09:01:43 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:03 GMT