given the following XML snippet:
<?xml version="1.0" encoding="UTF-8"?> <RootNode> <PR1>PR1</PR1> <ROL>one</ROL>* <ROL>two</ROL>* <DG1>DG1</DG1> <ROL>three</ROL> <ZBK>ZBK</ZBK> <ROL>four</ROL> </RootNode> Is it possible to select the two ROL elements that are right behind the PR1 element (the ones marked with an asterisk) with an XPath expression, but not the other ROL elements? I tried
//PR1/following-sibling::ROL but that would also get the other ROL segments. Is there a way to stop XPath looking for elements after the first non matching hit? Or maybe there is another approach without following-sibling?