Given the following partial XML document:
<section>
<entry typeCode="DRIV">
<act classCode="AT" moodCode="DEF">
<statusCode code="completed"/>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<statusCode code="completed"/>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<statusCode code="completed"/>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<statusCode code="completed"/>
</act>
</entry>
<section>
<entry typeCode="DRIV">
<act classCode="AT" moodCode="DEF">
<statusCode code="completed"/>
</act>
</entry>
<entry typeCode="DRIV">
<act classCode="ACT" moodCode="DEF">
<statusCode code="completed"/>
</act>
</entry>
</section>
</section>
I want to assert that all of the elements that are descendents of the outer <section>
element, but not the inner <section>
element, have for the classCode
attribute the value "ACT"
.
In other words, given the above example, I don't need to assert the value of the two <act>
children in the second <section>
element. Also, there can be one or more nested <entry>
elements (no maximum).
I tried the following XPath expression,
<xsl:when test="cda:section/cda:entry/cda:act//@classCode='ACT'"/>
If any of the <act>
elements has a value for the attribute classCode
other than "ACT"
, the assertion should fail. I am looking for advice on how to change my XPath expression to meet this requirement.