Re: [xsl] XPath context evaluation

Subject: Re: [xsl] XPath context evaluation
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 12 May 2006 13:18:22 +0100
> I apologize for hijacking the XSL list for XPath questions,

xpath is on-topic here.

> I have written some XSL-like application 


> however I am not able to
> use the current context (one of the <id> elements in the <idList>) to
> evaluate an XPath expression as "//info[id = .]" 

In pure Xpath 1 you can't do this. XSLT has three solutions though so
you just need to implement one of those in your language

1) an additional xpath function, current()

  "//info[id = current()]" 


2) The ability to bind XPath variables in the host language

<xsl:variable name="here" select="."/>
   .... select="//info[id = $here]"

3) Implement (at least parts of) XPath2 to allow variable binding within

   select="for $here in . return //info[id = $here]"


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:

Current Thread