Hello,
I'm using a Java application based on Saxon for the XPath parser. Please consider the following:
<import>
<record ref="abc">
<id>123</id>
<data>Value<data>
</record>
<record ref="def">
<parent>123</parent>
<data>Value2</data>
</record>
</import>
My use case is, I'm looping through the record nodes and need to look up another with attribute ref equal to the value under the child parent node.
If the current node is <record ref="def">
, how can I write a query to return the data node within the first record node by matching on /query/record/id/text() = current node/parent/text()
?
If I execute this query:
/import/record[id/text() = '123']/data
Then I get the correct data node, but I can't seem able to replace '123' for the value under the parent node?
I've tried replacing '123' with ./parent/text()
and while the XPath compiles, no results are returned.
Thanks,
JB