xsl-list
[Top] [All Lists]

Re: [xsl] XPath context evaluation

2006-05-12 05:20:51

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()]" 

  see http://www.w3.org/TR/xslt#function-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
   XPath.

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

David

________________________________________________________________________
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:
http://www.star.net.uk
________________________________________________________________________

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--