I got the following XML
<doc>
<start/>
<mandatory id='x1'/>
<optional id='foo'/>
<end/>
<start/>
<mandatory id='x2'/>
<end/>
<start/>
<mandatory id='x3'/>
<optional id='boo'/>
<end/>
</doc>
whose structure is flat. A coherent set of information begins with tag but ends with tag. Certain information within a set a mandatory, here but others are not, here
My process uses XPATH 1.0 to first extract the starting node, and after that for each starting node, I want to have the mandatory info as well as the optional one.
My problem is to find the proper XPATH expression to derive the optional node that fits to the current node of the iteration provided by
/doc/start
I already gave the Kayessian XPath 1.0 Formula
How to perform set operations in XPath 1.0 XPath select all elements between two specific elements
to derive a intersection of two sets a try
following-sibling::optional[count(. | following-sibling::end[1]/preceding-sibling::optional)=(count(following-sibling::end[1]/preceding-sibling::optional))]
Thanks a lot
cheers Christian