XPath - how to use position() in XMLInput

Hello folks,
i have come across this file that has no identifier for the <b>Item</b>:
<Items>
<Item>
<Detail1>A</Detail1>
<Detail3>B</Detail2>
<Detail4>B</Detail4>
...
</Item>
<Item>
<Detail2>B</Detail2>
<Detail4>B</Detail4>
...
</Item>
...
</Items>

i would like to get the output of this file normalised to:
Item   |Detail1   |Detail2     |Detail3     |Detail4
1 |A | |B |B

where the value of item would be returned by the XPath expression position()
But i am failing to understand how the expression should be entered in the tFileInputXML
this is a similar question to:
http://www.talendforge.org/forum/viewtopic.php?id=25395

and i would very much appreciate assistance with this.
regards
1 REPLY
One Star

Re: XPath - how to use position() in XMLInput

This shows an XPath that returns the sequence of the parent node.
http://blogs.msdn.com/b/asanto/archive/2004/09/08/226663.aspx
count(parent::*/preceding-sibling::*) + 1

However when run in 'Refresh Preview' or in a job the column is empty.
When the job is configured with 'Get Nodes' enabled on the tFileInputXML then the results show that the sequence is being calculated.
e.g. from a different dataset:
.-------------------+----------------------------------+--------.
| tLogRow_1 |
|=------------------+----------------------------------+-------=|
|key |value |entityid|
|=------------------+----------------------------------+-------=|
|key="jurisdiction" |value="GB" |1.0 |
|key="domicile" |value="UK" |1.0 |
How can the column I call 'entityid', computed from the earlier 'count...' XPath be accessed?
The first two columns of output show the full node value of their attribute, so could potentially be parsed.