So to expand...
I have some XML
<root>
<list>
<item value="9"/>
<item value="3"/>
<item value="1"/>
<item value="8"/>
<item value="4"/>
</list>
</root>
I have an XPath "/root/list/item [4]" which I believe will retrieve the 5th 'item' element (whose value attribute is 4)
This suggests that the XPath "/root/list/item [5]" will reference the (as yet non existent) 6th item.
What I would like is an XPath expression which will reference the 'Next' (as yet non-existant) 'item' element regardless of how many items there are currently...
I assume that this will pass an expression (which will count the number of current elements) rather than a hard coded number.
I know how I would do it, but simply cannot find how I should do it... frustrating.
Update: To clarify... I would like to return "the item node after the last item node". the attributes were there just to distinguish the existing nodes). I appreciate that this will return an empty nodeset.
Update: Well I have my answer so I guess it's only fair I explain why I wanted this :)
Basically the xPath is used by some .Net code as a write address rather than a read address.
I pass the xPath of a non existent location to an EnsureNodeExists routine. (Note: I cannot alter this EnsureNodeExists routine) The code will iterate each element of the xPath, creating it if it's not there and then setting it as the parent for the next iteration.
Thus I can call this code with "/root/list/item[position() = last()]/following-sibling::item[1]" 3 times and this will result in 3 item nodes being created.