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) =
(.)]".
Am I missing something obvious, is this a restriction of XPath?
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>
--~------------------------------------------------------------------
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>
--~--