Hi Folks,
Consider this XML:
<sequences>
<sequence>
<item>A</item>
</sequence>
<sequence>
<item>A</item>
<item>B</item>
</sequence>
</sequences>
Suppose that $sequence-extended has this value:
<sequence>
<item>A</item>
<item>B</item>
</sequence>
And $sequence has this value:
<sequence>
<item>A</item>
</sequence>
And $item has this value:
<item>B</item>
I want an XPath expression which expresses this:
The $sequence-extended items equals
the $sequence items plus $item.
This XPath expression seems to work:
$sequence-extended/item = ($sequence/item, $item)
But, the XPath expression fails when $sequence is empty:
<sequence/>
And $sequence-extended has a single item:
<sequence>
<item>A</item>
</sequence>
And $item is:
<item>A</item>
What XPath 2.0 expression works in all cases?
Note: I seek simplicity and plainness over efficiency and cleverness.
/Roger
|