I have following XML:
<root>
<chp id='1'>
<sent id='1'>hello</sent>
<sent id='2'>world</sent>
</chp>
<chp id='2'>
<sent id='1'>the</sent>
<sent id='2'>best</sent>
<sent id='3'>world</sent>
</chp>
</root>
Using the XPath expression
root/chp/sent[contains(.,'world')]/@id
I have the result 2 3
(which is exactly what I want), but when I run
concat('sentence ', /root/chp/sent[contains(.,'world')]/@id, ' - chap ' , /root/chp/sent[contains(.,'world')]/../@id )
the result breaks at the first result:
sentence 2 - chap 1