I am trying to retreive the XML position value for a node:
create table xmltest
(data XMLTYPE);
insert into xmltest
values ('<fruit><apple/><banana/><orange/></fruit>');
select x.*
from xmltest t,
XMLTable('/fruit'
passing t.data
columns
orange_index varchar2(10) path 'count(orange/preceding-sibling::*)+1'
) x;
However this always returns a value of 2 regardless of the node (apple, banna, orange) that is being pointed to by the path expression. The values I am expectingr are apple=1, banana=2, orange=3.
Does anyone know how to get the position value for a node with XMLTable?
Thanks,
Gary