Subject: RE: RE : Re: Accessing elements with key via string in variable
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 26 Jun 2006 11:45:21 +0100
|
> I don't think so. Personnaly, I use the three-parameters
> version of key() only when I need a subtree, not a document.
> If I just need to set the context node for the calling point,
> I use instead:
>
> $input/key('things-by-a', .)
>
> But I guess it is a matter of taste.
I tend to use the 3-arg form. It's not just a matter of taste,
key('things-by-a', ., $input)
doesn't mean the same as
$input/key('things-by-a', .)
because the context node "." is different in the two cases, which will often
affect the evaluation of the second argument.
Michael Kay
http://www.saxonica.com/
|