<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 1.3.6.1.4.1.19376.1.3.1.4
Name: Befundgruppen (Laboratory Battery Organizer)
Description: 
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000">
   <title>Befundgruppen (Laboratory Battery Organizer)</title>
   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]
Item: (LaboratoryBatteryOrganizer)
-->

   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']
Item: (LaboratoryBatteryOrganizer)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']"
         id="tmp-r-90b9ba3c-a06c-4d59-908f-99ad0b32127d">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="string(@classCode)=('BATTERY')">(LaboratoryBatteryOrganizer): Der Wert von @classCode MUSS 'BATTERY' sein.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="string(@moodCode)=('EVN')">(LaboratoryBatteryOrganizer): Der Wert von @moodCode MUSS 'EVN' sein.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:templateId[@root='1.3.6.1.4.1.19376.1.3.1.4'])&gt;=1 ">(LaboratoryBatteryOrganizer): Element hl7:templateId[@root='1.3.6.1.4.1.19376.1.3.1.4'] ist required [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:templateId[@root='1.3.6.1.4.1.19376.1.3.1.4'])&lt;=1">(LaboratoryBatteryOrganizer): Element hl7:templateId[@root='1.3.6.1.4.1.19376.1.3.1.4'] kommt zu häufig vor [max 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:code[concat(@code,@codeSystem)=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)])&gt;=1 and not(hl7:code[concat(@code,@codeSystem)=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]/@nullFlavor)">(LaboratoryBatteryOrganizer): Element hl7:code[concat(@code,@codeSystem)=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)] ist mandatory [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:code[concat(@code,@codeSystem)=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)])&lt;=1">(LaboratoryBatteryOrganizer): Element hl7:code[concat(@code,@codeSystem)=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)] kommt zu häufig vor [max 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(LaboratoryBatteryOrganizer): Element hl7:statusCode[@code='completed'] ist mandatory [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(LaboratoryBatteryOrganizer): Element hl7:statusCode[@code='completed'] kommt zu häufig vor [max 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:effectiveTime)&lt;=1">(LaboratoryBatteryOrganizer): Element hl7:effectiveTime kommt zu häufig vor [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:templateId[@root='1.3.6.1.4.1.19376.1.3.1.4']
Item: (LaboratoryBatteryOrganizer)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:templateId[@root='1.3.6.1.4.1.19376.1.3.1.4']"
         id="tmp-r-aa5d8916-7f9c-433b-9aad-cd26e11cc9b8">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(LaboratoryBatteryOrganizer): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:II" haben, gefunden "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="II"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="string(@root)=('1.3.6.1.4.1.19376.1.3.1.4')">(LaboratoryBatteryOrganizer): Der Wert von @root MUSS '1.3.6.1.4.1.19376.1.3.1.4' sein.</assert>
   </rule>
   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:code[concat(@code,@codeSystem)=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]
Item: (LaboratoryBatteryOrganizer)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:code[concat(@code,@codeSystem)=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]"
         id="tmp-r-d5efe6b0-58c7-4f8b-99b3-4a7668060211">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CE' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(LaboratoryBatteryOrganizer): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:CE" haben, gefunden "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CE"/>
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <let name="theCodeSystemVersion" value="@codeSystemVersion"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="@nullFlavor or exists(doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet[conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion] or completeCodeSystem[@codeSystem=$theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion]])">(LaboratoryBatteryOrganizer): Der Elementinhalt MUSS einer von 'ELGA_Laborstruktur (DYNAMIC)' sein.</assert>
      <let name="theNullFlavor" value="@nullFlavor"/>
      <let name="validNullFlavorsFound"
           value="exists(doc('include/voc-1.2.40.0.34.10.47-DYNAMIC.xml')/*/valueSet/conceptList/exception[@code = $theNullFlavor][@codeSystem = '2.16.840.1.113883.5.1008'])"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="not(@nullFlavor) or $validNullFlavorsFound">(LaboratoryBatteryOrganizer): Der fehlende Wert '<value-of select="@nullFlavor"/>' für @code MUSS gewählt werden aus dem Set gültiger null flavors für dieses Attribut oder denen assoziiert mit Value Set ELGA_Laborstruktur (DYNAMIC).</assert>
   </rule>
   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:statusCode[@code='completed']
Item: (LaboratoryBatteryOrganizer)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:statusCode[@code='completed']"
         id="tmp-r-19833033-35e6-42ee-b75a-1f8b127b14a3">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(LaboratoryBatteryOrganizer): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:CS" haben, gefunden "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="@nullFlavor or (@code='completed')">(LaboratoryBatteryOrganizer): Der Elementinhalt MUSS einer von 'code 'completed'' sein.</assert>
   </rule>
   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:effectiveTime
Item: (LaboratoryBatteryOrganizer)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:effectiveTime"
         id="tmp-r-d6ced9e9-e84b-49f9-8718-a1cdc55631b3">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='IVL_TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(LaboratoryBatteryOrganizer): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:IVL_TS" haben, gefunden "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="IVL_TS"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:low)&gt;=1 and not(hl7:low/@nullFlavor)">(LaboratoryBatteryOrganizer): Element hl7:low ist mandatory [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:low)&lt;=1">(LaboratoryBatteryOrganizer): Element hl7:low kommt zu häufig vor [max 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:high)&gt;=1 and not(hl7:high/@nullFlavor)">(LaboratoryBatteryOrganizer): Element hl7:high ist mandatory [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="count(hl7:high)&lt;=1">(LaboratoryBatteryOrganizer): Element hl7:high kommt zu häufig vor [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:effectiveTime/hl7:low
Item: (LaboratoryBatteryOrganizer)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:effectiveTime/hl7:low"
         id="tmp-r-5b0591c3-e625-4fde-8edc-702842b0e865">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(LaboratoryBatteryOrganizer): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:TS" haben, gefunden "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="TS.DATE.MIN"/>
   </rule>
   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:effectiveTime/hl7:high
Item: (LaboratoryBatteryOrganizer)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:effectiveTime/hl7:high"
         id="tmp-r-c4568c5f-9dcf-4de6-b7f3-45ad21395cc6">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(LaboratoryBatteryOrganizer): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:TS" haben, gefunden "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="TS.DATE.MIN"/>
   </rule>

   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observation[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.6']]
Item: (LaboratoryBatteryOrganizer)
-->
   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observation[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.6']]">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="string(@typeCode)=('COMP')">(LaboratoryBatteryOrganizer): Der Wert von @typeCode MUSS 'COMP' sein.</assert>
   </rule>

   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]
Item: (LaboratoryBatteryOrganizer)
-->
   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]">
      <extends rule="tmp-r-fe3e4728-b952-4800-b40f-f4cd13fd7440"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="string(@typeCode)=('COMP')">(LaboratoryBatteryOrganizer): Der Wert von @typeCode MUSS 'COMP' sein.</assert>
   </rule>

   <!--
Template derived rules for ID: 1.2.40.0.34.11.30030
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]
Item: (MultimediaContent)
-->
   <rule id="tmp-r-fe3e4728-b952-4800-b40f-f4cd13fd7440" abstract="true">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="count(hl7:observationMedia)&gt;=1 ">(MultimediaContent): Element hl7:observationMedia ist required [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="count(hl7:observationMedia)&lt;=1">(MultimediaContent): Element hl7:observationMedia kommt zu häufig vor [max 1x].</assert>
   </rule>

   <!--
Template derived rules for ID: 1.2.40.0.34.11.30030
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]/hl7:observationMedia
Item: (MultimediaContent)
-->
   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]/hl7:observationMedia">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="string(@classCode)=('OBS')">(MultimediaContent): Der Wert von @classCode MUSS 'OBS' sein.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="string(@moodCode)=('EVN')">(MultimediaContent): Der Wert von @moodCode MUSS 'EVN' sein.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="@ID">(MultimediaContent): Attribut @ID MUSS vorkommen.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="count(hl7:value)&gt;=1 and not(hl7:value/@nullFlavor)">(MultimediaContent): Element hl7:value ist mandatory [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="count(hl7:value)&lt;=1">(MultimediaContent): Element hl7:value kommt zu häufig vor [max 1x].</assert>
   </rule>

   <!--
Template derived rules for ID: 1.2.40.0.34.11.30030
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]/hl7:observationMedia/hl7:id
Item: (MultimediaContent)
-->
   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]/hl7:observationMedia/hl7:id">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(MultimediaContent): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:II" haben, gefunden "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="II"/>
   </rule>

   <!--
Template derived rules for ID: 1.2.40.0.34.11.30030
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]/hl7:observationMedia/hl7:value
Item: (MultimediaContent)
-->
   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:observationMedia]/hl7:observationMedia/hl7:value">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='ED' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(MultimediaContent): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:ED" haben, gefunden "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="ED"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="@mediaType">(MultimediaContent): Attribut @mediaType MUSS vorkommen.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="not(@mediaType) or (string-length(@mediaType)&gt;0 and not(matches(@mediaType,'\s')))">(MultimediaContent): Attribute @mediaType MUSS vom Datentyp 'cs' sein</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@mediaType),' '))"/>
      <let name="theAttCheck"
           value="distinct-values(document('include/voc-1.2.40.0.34.10.42-DYNAMIC.xml')/*/valueSet/conceptList/concept[@code = $theAttValue]/@code)"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="not(@mediaType) or count($theAttValue) = count($theAttCheck)">(MultimediaContent): Der Wert von mediaType MUSS gewählt werden aus Value Set 'ELGA_Medientyp' (DYNAMIC).</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.2.40.0.34.11.30030-2012-01-07T000000.html"
              test="string(@representation)=('B64')">(MultimediaContent): Der Wert von @representation MUSS 'B64' sein.</assert>
   </rule>

   <!--
Template derived rules for ID: 1.3.6.1.4.1.19376.1.3.1.4
Context: *[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:act[hl7:templateId/@root='1.2.40.0.34.11.4.3.2' and hl7:templateId/@root='2.16.840.1.113883.10.20.1.40' and hl7:templateId/@root='1.3.6.1.4.1.19376.1.5.3.1.4.2']]
Item: (LaboratoryBatteryOrganizer)
-->
   <rule context="*[hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']]/hl7:organizer[hl7:templateId/@root='1.3.6.1.4.1.19376.1.3.1.4']/hl7:component[hl7:act[hl7:templateId/@root='1.2.40.0.34.11.4.3.2' and hl7:templateId/@root='2.16.840.1.113883.10.20.1.40' and hl7:templateId/@root='1.3.6.1.4.1.19376.1.5.3.1.4.2']]">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-1.3.6.1.4.1.19376.1.3.1.4-2013-09-09T000000.html"
              test="string(@typeCode)=('COMP')">(LaboratoryBatteryOrganizer): Der Wert von @typeCode MUSS 'COMP' sein.</assert>
   </rule>
</pattern>
