- From: Maarten Marx <marx@science.uva.nl>
- Date: Thu, 27 Nov 2003 14:27:47 +0100
- To: David Carlisle <davidc@nag.co.uk>
- Cc: public-qt-comments@w3.org
You are right. My example was not precise enough. Here is what I meant with the information need: Find descendants y of the current node x such that y does not have leukemia, and all ancestors z of y BELOW x (that is, z=x or z is a descendant of x) have leukemia. Consider the example doc <P name="a1" l="no"> <P name="a12" l="yes"> <P name="a121" l="no"/> </P> </P> Then the correct answer when evaluated at the root is the empty set. But when evaluated at the node with name="a12" it is <P name="a121" l="no"/>. The formalisation given below yields the empty set in both cases. maarten On Thu, Nov 27, 2003 at 12:02:57PM +0000, David Carlisle wrote: > > I believe that your requirement is already expressible in Xpath 1 > > "find all nodes with l=no such that all their ancestors do not have l=no" > > <P name="a" l="yes"> > <P name="a1" l="no"> > <P name="a11" l="no"/> > <P name="a12" l="yes"/> > <P name="a13" l="no"/> > </P> > <P name="a2" l="yes"> > <P name="a21" l="yes"/> > <P name="a22" l="no"/> > > </P> > </P> > > In this example you want to find a1 and a22 I think. > > > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> > > <xsl:template match="/"> > <xsl:for-each select="//* > [@l='no' and not(ancestor::*/@l='no')]/@name"> > [<xsl:value-of select="."/>] > </xsl:for-each> > </xsl:template> > > </xsl:stylesheet> > > > > $ saxon luk.xml luk.xsl > <?xml version="1.0" encoding="utf-8"?> > [a1] > > [a22] > > > > In this case you can phrase things to use the implicit existential > quantification of = in xpath 1, although in more complicated cases > that gets difficult/impossible, so then the xpath2 quantifiers some every > would probably help. > > > David [Not a member of the WG] > > > ________________________________________________________________________ > 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 > ________________________________________________________________________ -- *************************************************************************** Maarten Marx marx@science.uva.nl http://www.science.uva.nl/~marx Language and Inference Technology Group, ILLC, Universiteit van Amsterdam Nieuwe Achtergracht 166, 1018 WV Amsterdam, The Netherlands. Phone: +31 20 525 2888 Mobile: 06 400 16 120 Fax: +31 20 525 2800 ***************************************************************************
Received on Thursday, 27 November 2003 08:27:49 UTC