Subject: RE: XPath2 preceding / following axis and attributes
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Tue, 10 Jan 2006 10:53:42 -0000
|
I think the results here are correct. The text node "205" is a descendant of
the element containing the attribute, but it's not a descendant of the
attribute, so it is included in the result.
Or have I misunderstood?
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Dimitre Novatchev [mailto:dnovatchev@xxxxxxxxx]
> Sent: 10 January 2006 10:11
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: XPath2 preceding / following axis and attributes
>
> On 1/10/06, Michael Kay <mike@xxxxxxxxxxxx> wrote:
> > > In fact, it is easy to see that the following two XPath
> expressions
> > > are equivalent:
> > >
> > > someElement/@someAttribute/following::someNodeTest
> > >
> > > and
> > >
> > > someElement/following::someNodeTest
> >
> > No, I don't think that's correct. The former includes descendants of
> > someElement, the latter doesn't.
>
> If so, then Saxon 8.6.1 produces an unexpected result:
>
> When this transformation:
>
> <xsl:stylesheet version="2.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >
>
> <xsl:output omit-xml-declaration="yes" indent="yes"/>
>
> <xsl:template match="/">
> <xsl:sequence select=
> "/*/Sample/Data[1]/@category/following::node()"
> />
> </xsl:template>
> </xsl:stylesheet>
>
>
> is applied with Saxon 8.6.1on this source xml document:
>
> <Performance>
> <Sample timestamp="Wednesday, November 30, 2005 5:10:02 PM">
> <Data category="Memory" counter="Available MBytes"
> instance="">205</Data>
> <Data category="Process" counter="Private Bytes"
> instance="lsass">1.397146E+07</Data>
> <Data category="Process" counter="Virtual Bytes"
> instance="svchost">6.877594E+07</Data>
> <Data category="Process" counter="Virtual Bytes"
> instance="winword">5.653791E+08</Data>
> </Sample>
> <Sample timestamp="Wednesday, November 30, 2005 5:10:04 PM">
> <Data category="Memory" counter="Available MBytes"
> instance="">192</Data>
> <Data category="Process" counter="Private Bytes"
> instance="lsass">1.403699E+07</Data>
> <Data category="Process" counter="Virtual Bytes"
> instance="svchost">6.877594E+07</Data>
> <Data category="Process" counter="Virtual Bytes"
> instance="winword">5.653791E+08</Data>
> </Sample>
> </Performance>
>
> the following result is produced:
>
> 205
> <Data category="Process" counter="Private Bytes"
> instance="lsass">1.397146E+07</Data>1.397146E+07
> <Data category="Process" counter="Virtual Bytes"
> instance="svchost">6.877594E+07</Data>6.877594E+07
> <Data category="Process" counter="Virtual Bytes"
> instance="winword">5.653791E+08</Data>5.653791E+08
>
> <Sample timestamp="Wednesday, November 30, 2005 5:10:04 PM">
> <Data category="Memory" counter="Available MBytes"
> instance="">192</Data>
> <Data category="Process" counter="Private Bytes"
> instance="lsass">1.403699E+07</Data>
> <Data category="Process" counter="Virtual Bytes"
> instance="svchost">6.877594E+07</Data>
> <Data category="Process" counter="Virtual Bytes"
> instance="winword">5.653791E+08</Data>
> </Sample>
> <Data category="Memory" counter="Available MBytes"
> instance="">192</Data>192
> <Data category="Process" counter="Private Bytes"
> instance="lsass">1.403699E+07</Data>1.403699E+07
> <Data category="Process" counter="Virtual Bytes"
> instance="svchost">6.877594E+07</Data>6.877594E+07
> <Data category="Process" counter="Virtual Bytes"
> instance="winword">5.653791E+08</Data>5.653791E+08
>
>
> So, is this a Saxon 8.6.1 bug in handling the "following" axis?
>
> --
> Cheers,
> Dimitre Novatchev
> ---------------------------------------
> To avoid situations in which you might make mistakes may be the
> biggest mistake of all.
|