XPATH: Select ements whose parent-element have a child-element with the name "x" containing the value "y"



I have the following XML Instance and need to find the XPath Statement for: All "name" elements whose parent-element ("norm" elements) have a child-element named "Keyword" containing the value "Engines"



<?xml version="1.0" encoding="UTF-8"?>



<norms>

<norm id="1" normid="2">
<Name id="3">EN ISO 13857</Name>
<Keyword>Security</Keyword>
<Keyword>Engines</Keyword>
<ReplacementFor></ReplacementFor>
</norm>

<norm id="2" normid="1">
<Name>EN ISO 13849-1</Name>
<Keyword>Security</Keyword>
<Keyword>Engines</Keyword>
<Keyword>Controlling</Keyword>
<ReplacementFor>EN ISO 13857</ReplacementFor>
</norm>

</norms>

<publications>
<publication id="4" normid="1 2">
<Title>Norms for Engine Security</Title>
<FileName>caise2011sgln.pdf</FileName>
</publication>

<publication id="5" normid="2">
<Title>Setting up Complex Engines</Title>
<FileName>coopis2012sln.pdf</FileName>
</publication>

</publications>


Thank you very much in advance!


No comments:

Post a Comment