XPath - get parent node
- by chris.shi
//* [ local-name()='component' and namespace-uri()='urn:hl7-org:v3' ]
using thispath ,I can get a node like this:
<component xmlns="urn:hl7-org:v3">
<structuredBody>
<component>
<section>
<code code="10164-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>History of Present Illness</title>
<text>
</text>
</section>
</component>
<component>
......
</component>
<component>
......
</component>
<structuredBody/>
<component/>
in order to get the node as below:
<component>
<section>
<code code="10164-2" codeSystem="2.16.840.1.113883.6.1" codeSystemName="LOINC"/>
<title>History of Present Illness</title>
<text>
</text>
</section>
</component>
I change the path to :
//* [ local-name()='component' and namespace-uri()='urn:hl7-org:v3' and position()=1]
but ,how can I get the same result by using [code="10164-2"] as a qualification.
( I do not know how to describe this question ,as a result ,the title of this question is a little simple ,sorry .)
thanks