xml - xpath multiple conditions with different tags -


i have problem validate xml document, need arrive target tags <templateid root="2.16.840.1.113883.10.20.33.4.4"/> , <entryrelationship>, both conditions must achieve, because if these 2 conditions achieve ,i able check if entryrelationship has <templateid root="2.16.840.1.113883.10.20.33.4.2"/>. have done this:

<rule context="//cda:entry/cda:organizer/cda:component/cda:observation[(./templateid/*[@root='2.16.840.1.113883.10.20.33.4.4']) , (./entryrelationship/*[@typecode='refr'])]">    <!--<rule context='*[cda:templateid/@root="2.16.840.1.113883.10.20.33.4.4"]'>-->    <assert test="self::cda:entryrelationship[@typecode='refr']">       fail: conf-qr-176: entryrelationship, if present, shall contain 1 [1..1] @typecode="refr" (codesystem: hl7actrelationshiptype 2.16.840.1.113883.5.1002).  line:        <value-of select="@_line"/>    </assert>    <assert test="count(cda:entryrelationship/cda:observation/cda:templateid[@root='2.16.840.1.113883.10.20.33.4.2'])=1">       fail: conf-qr-177: entryrelationship, if present,shall contain 1 [1..1] question text pattern observation template (templateid 2.16.840.1.113883.10.20.32.4.19).  line:        <value-of select="@_line"/>    </assert> </rule> 

but not work,i need help, much.

this xml:

<component>    <sequencenumber value="4"/>    <observation classcode="obs" moodcode="evn">       <!--templateid numeric response pattern-->       <templateid root="2.16.840.1.113883.10.20.33.4.4"/>       <languagecode></languagecode>       <entryrelationship typecode="refr">          <!--templateid response media pattern template-->          <!--<templateid root="2.16.840.1.113883.10.20.33.4.2"/>-->       </entryrelationship>       <id extension="ob4" root="2.16.840.1.113883.3.1817.1.6"/>       <code code="q4" codesystem="continua-q-oid">          <originaltext>how many hours did sleep last night?</originaltext>       </code>       <statuscode code="completed"/>       <value xsi:type="int" value="7"/>       <referencerange typecode="refv">          <!--templateid response reference range pattern-->          <templateid root="2.16.840.1.113883.10.20.33.4.3"/>          <observationrange>             <text></text>             <value xsi:type="ivl_int">                <low value="0"/>                <high value="24"/>             </value>          </observationrange>       </referencerange>    </observation> </component> 

if understand question correctly, based on xpath rule context attribute, can try way (formatted readability) :

//cda:entry /cda:organizer /cda:component /cda:observation[     templateid/@root='2.16.840.1.113883.10.20.33.4.4'          ,      entryrelationship/@typecode='refr' ] 

then regarding xpath "assert test", since context node <observation>, self::cda:entryrelationship doesn't make sense me. try instead -or maybe without / @ beginning- :

<assert test="/cda:entryrelationship[@typecode='refr']"> 

<entryrelationship> child of context node, not context node self, above expression makes more sense try.


Comments

Popular posts from this blog

apache - PHP Soap issue while content length is larger -

asynchronous - Python asyncio task got bad yield -

javascript - Complete OpenIDConnect auth when requesting via Ajax -