Get node parent of defined type using xpath

Posted by IordanTanev on Stack Overflow See other posts from Stack Overflow or by IordanTanev
Published on 2010-03-15T14:03:37Z Indexed on 2010/03/15 14:09 UTC
Read the original article Hit count: 150

Filed under:
|
|

Hi,
i will give an example of the problem i have. My XML is like this

<roor>
  <child Name = "child1">
  <node>
  <element1>Value1</element1>
  <element2>Value2</element2>
  </node>
  </child>
  <child Name = "child2">
  <element1>Value1</element1>
  <element2>Value2</element2>
  <element3>Value3</element3>
  </child>
</root>

I have xpath expression that returns all "element2" nodes. Then i want to for every node of type "element2" to find the node of type "child" that contains it. The problem is that between these two nodes there can be from 1 to n different nodes so i can't just use "..". Is there something like "//" that will look up instead of down
Best Regards,
Iordan

© Stack Overflow or respective owner

Related posts about Xml

Related posts about xpath