Subject: Re: [xsl] XPath context evaluation From: Victor Toni <xsl-list@xxxxxxxxx> Date: Fri, 12 May 2006 20:32:21 +0200 |
(e.g. "//info[id = '123']" ) shows no issues, 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 = .]" or "//info[string(id) = (.)]".
Am I missing something obvious, is this a restriction of XPath?
The current context changes inside the []. Just as "id" means "the id child
of the info element being tested, so "." means "the info element being
tested". If you want to refer to some other element, use a variable (or in
XSLT, current()).
I have attached a mapping file as an example to show why I am restricted to XPath.
My current setup included dom4j and Jaxen with some special extensions, after some digging though it's mailing list it seems as it's not possible to implement a "current()" function for Jaxen. Having tried the JAXP's default implementation I've seen that it can use "current()" within DOM. However I am not sure about porting the extensions I had previously written for Jaxen. Saxon seemed a better approach but I still have to find a way to trick around its strictness ;-) :
Caused by: net.sf.saxon.trans.StaticError: XPath syntax error at char 21 in {//info[id = current()]/}: Cannot use the current() function in a non-XSLT context
<repeatable target-name="Data" xpath="some"> <data target-name="Readme" xpath="readme"/>
<repeatable target-name="Entries" xpath="//info[id = current()/idList/id]"> <data target-name="Name" xpath="name"/> <data target-name="ID" xpath="id"/>
<data target-name="selected" xpath="string('1')"/> </repeatable>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] XPath context evaluation, Michael Kay | Thread | RE: [xsl] XPath context evaluation, Michael Kay |
[xsl] generic grid, viniciuscamara | Date | RE: [xsl] Namespace-alias using #de, Buchcik, Kasimier |
Month |