Subject: [xsl] XPath context evaluation From: Victor Toni <xsl-list@xxxxxxxxx> Date: Fri, 12 May 2006 14:03:58 +0200 |
I apologize for hijacking the XSL list for XPath questions, I wish there would be some kind of XPath list ..
I have written some XSL-like application (maybe a bit more like FOP) which uses the results of XPath expression as trigger for further processing: The attached file is a stripped down example of an XML file I would like to process. At some point I am iterating over the <some> element and it's children. I would like to retrieve the associated <info> element from the <infoList> for a given <id> element in the <idList>. Since the application is agnostic about the data it reads I want to use an XPath expression to find the correct element. Using a string as '123' (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) = (.)]".
Kindest regards, Victor
<?xml version="1.0" encoding="UTF-8"?> <root> <infoList> <info> <name>abc</name> <id>123</id> </info> <info> <name>klm</name> <id>456</id> </info> <info> <name>xyz</name> <id>789</id> </info> </infoList> <data> <someList> <some> <readme>some words</readme> <idList> <id>123</id> </idList> </some> <some> <readme>some more words</readme> <idList> <id>123</id> <id>456</id> </idList> </some> <some> <readme>famous last words</readme> <idList> <id>456</id> <id>789</id> </idList> </some> </someList> </data> </root>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] Namespace-alias using #de, Buchcik, Kasimier | Thread | Re: [xsl] XPath context evaluation, David Carlisle |
RE: [xsl] Namespace-alias using #de, Buchcik, Kasimier | Date | Re: [xsl] Namespace-alias using #de, Frans Englich |
Month |