This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Re: Re: limiting preceding axis by ancestor
- From: "Michael Kay" <michael dot h dot kay at ntlworld dot com>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 9 May 2002 13:36:06 +0100
- Subject: RE: [xsl] Re: Re: limiting preceding axis by ancestor
- Reply-to: xsl-list at lists dot mulberrytech dot com
generate-id(), like many other functions in XPath, is defined to use the
node that is first in document order. The path expression used to obtain the
node-set is irrelevant.
Michael Kay
Software AG
home: Michael.H.Kay@ntlworld.com
work: Michael.Kay@softwareag.com
> -----Original Message-----
> From: owner-xsl-list@lists.mulberrytech.com
> [mailto:owner-xsl-list@lists.mulberrytech.com]On Behalf Of Joerg
> Heinicke
> Sent: 09 May 2002 01:02
> To: xsl-list@lists.mulberrytech.com
> Subject: Re: [xsl] Re: Re: limiting preceding axis by ancestor
>
>
> Hello Dimitre,
>
> I thought that this is true, *because* it's a reverse axis. I
> used [1]
> because I wanted the nearest ancestor. The question for me is "Why is
> the returned nodeset ancestor::foo upside down, so back in document
> order again?"
>
> So, while thinking is rarely being, the [1] is not implicit, it's a
> must. Sorry for the confusion.
>
> Joerg
>
> Dimitre Novatchev schrieb:
> > Joerg Heinicke <joerg dot heinicke at gmx dot de> wrote:
> >
> >
> >>The [1] is implicit and not needed, because generate-id() on a
> >>nodeset returns the id of the first element in this
> nodeset. I wrote
> >>it for maybe better understanding.
> >>
> >><xsl:if test=". = preceding::bar[generate-id(ancestor::foo[1]) =
> >>generate-id(current()/ancestor::foo[1])]">
> >
> >
> > This is one case where the established belief that
> >
> > generate-id(someXPathExpression) =
> generate-id(someXPathExpression[1])
> >
> > is *not* true.
> >
> > This is clearly not so, because "ancestor" is a reverse axis.
> >
> > generate-id(ancestor::foo[1])
> >
> > will be applied on the nearest ancesstor (the last in
> document order)
> >
> > while
> >
> > generate-id(ancestor::foo)
> >
> > will be applied on the outermost ancestor (the first in document
> > order).
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list