title: XMLTABLE extract element's posision()
body: <p>I have XML like:</p>
  
  <pre><code>&lt;all&gt;
      &lt;cell&gt;
          &lt;data&gt;A&lt;/data&gt;
          &lt;data&gt;A1&lt;/data&gt;
          &lt;data&gt;A2&lt;/data&gt;
          &lt;data&gt;A3&lt;/data&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
          &lt;data&gt;B&lt;/data&gt;
          &lt;data&gt;C&lt;/data&gt;
          &lt;data&gt;D&lt;/data&gt;
          &lt;data&gt;E&lt;/data&gt;
      &lt;/cell&gt;
      &lt;cell&gt;
          &lt;data&gt;X&lt;/data&gt;
          &lt;data&gt;X&lt;/data&gt;
          &lt;data&gt;X&lt;/data&gt;
          &lt;data&gt;X&lt;/data&gt;
      &lt;/cell&gt;
  &lt;/all&gt;
  </code></pre>
  
  <p>I want to extract in table content on every all/cell/data and unique path to the element. There aren't IDs in attributes or another unique mark and my idea for unique path is for example: </p>
  
  <p><strong>/all/cell[2]/data[5]</strong> </p>
  
  <p>Expected result(example XML) is:</p>
  
  <pre><code>Content | Path
  ----------------------
  A       |/all/cell[1]/data[1]
  A1      |/all/cell[1]/data[2]
  A2      |/all/cell[1]/data[3]
  A3      |/all/cell[1]/data[4]
  B       |/all/cell[2]/data[1]
  C       |/all/cell[2]/data[2]
  D       |/all/cell[2]/data[3]
  E       |/all/cell[2]/data[4]
  X       |/all/cell[3]/data[1]
  X       |/all/cell[3]/data[2]
  X       |/all/cell[3]/data[3]
  X       |/all/cell[3]/data[4]
  </code></pre>
  
  <p>I tried using XMLTABLE to call <em>posision()</em> of elements but it returns only "1" for every element.</p>
  
  <pre><code>select b.*
    from dropme a,
         xmltable('/all/cell/data' passing
                  xmltype(xml_text) columns 
                  cmp_old varchar2(200) path 'text()', -- work corect!
                  cmp_old1 varchar2(200) path '.', -- work corect! Result is same as cmp_old(upper filed)
                  rowcnt number path 'position()', -- return only value "1"
                  rowname varchar2(200) path 'name()', -- work corect! Return "data" as result
                  parent_rowcnt number path '../position()', -- return only value "1"
                  parent_rowname varchar2(200) path '../name()' -- work corect! Return "cell" as result
                  ) b;
  </code></pre>
  
  <p>I can't understand why it works for functions <em>name()</em> and <em>text()</em> but there is problem with <em>position()</em>.</p>
  
  <p>I try to find problem with <em>position()</em> or another solution to extract path and content of all element.</p>