Re: [xsl] Context node traversal inside predicates (was: Nodes and Strings)

Subject: Re: [xsl] Context node traversal inside predicates (was: Nodes and Strings)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Wed, 27 Jul 2005 06:25:12 +1000
Joris,

> I can't wait for my ordered copies of Mike's XSLT 2.0 and Xpath 2.0 books

Why are you so late? :o)

Cheers,
Dimitre.

On 7/26/05, Joris Gillis <roac@xxxxxxxxxx> wrote:
> Tempore 15:35:46, die 07/26/2005 AD, hinc in
> xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Michael Kay <mike@xxxxxxxxxxxx>:
> 
> >> The 'context()' function would be similar to the 'current()' fuction.
> >> It would recall previous context nodes.
> >>
> >> 'context(n)' would recall the n-th context node (as found
> >> when propagating
> >> upwards in the predicates of the expression)
> >>
> >> e.g.:
> >> 'context(0)' is equal to '.'
> >> 'context(1)' is equal to the context node as constructed by the
> >> immmediately outer predicate.
> >> ...
> >> 'context(-1)' would be equal to the context node as found in
> >> the outermost
> >> predicate.
> >
> > Something like this was in an early draft of XPath 1.0, and was
> > implemented
> > (IIRC) in WD-xsl, though I've rarely seen it used in practice.
> >
> > I think the idea of manually addressing the stack of context variables is
> > very error-prone and counter-intuitive. The proper way to do this is to
> > declare a range variable. In XQuery you can do this using the "let"
> > clause
> > of the FLWOR expression; XPath 2.0 has a poor man's version in the "for"
> > expression
> 
> Thank you, David and Michael, for your most enlightening answers.
> 
> They served me as a nice introduction to XPath 2.0
> I can't wait for my ordered copies of Mike's XSLT 2.0 and Xpath 2.0 books
> to arrive. They should be delivered any day now... Ok, I've been telling
> that myself for the last 2 weeks;)
> 
> kind regards,
> --
> Joris Gillis (http://users.telenet.be/root-jg/me.html)
> "Em o_da |ti oud]m o_da"  - Syjqatgr
> 
> 


-- 
Cheers,
Dimitre Novatchev
---------------------------------------
Harry did not ask how Dumbledore knew; ...but Harry had long since
learned that bangs and smoke were more often the marks of ineptitude
than expertise.

Current Thread