RE: Getting the original context node while inside predicate

An early draft of XSLT 1.0 had such a capability (provided with a context(N)
function) and it was implemented in the Microsoft WD-xsl dialect which is
still present in Internet Explorer and still sometimes used. Experience
showed it to be pretty unusable, and I think it's good that it was pulled
from the spec before XSLT 1.0 came out. Reliance on context is responsible
for many programming errors and having more than one context compounds this.
To do a join it's much better to bind explicit range variables to the
different sets of nodes you are joining.

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: public-qt-comments-request@w3.org 
> [mailto:public-qt-comments-request@w3.org] On Behalf Of David Sisson
> Sent: 23 March 2007 21:50
> To: public-qt-comments@w3.org
> Subject: Getting the original context node while inside predicate 
> 
> 
> get at the original context item while inside a predicate.  
> Should there be an axis that allows you to go up the previous 
> context items?
> 
>   	The typical use case for this is where you join two 
> sets of nodes together based on a key.
> 
> <xsl:variable name="key"><xsl:value-of 
> select="key"></xsl:variable> <xsl:value-of 
> "//otheritems[@key=$key]" />
> 
> 
> 	Besides cleaning up the above syntax it would make it 
> possible to use in conjunction with <xsl:sort> (since you 
> can't take a timeout to declare an <xsl:variable> before an 
> <xsl:sort> at least in XSLT 1.0).
> 
> 
> 
> 
> 
> 

Received on Sunday, 25 March 2007 00:41:33 UTC