<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.10.20.6.2.8
Name: SopInstance (DICOM Service Object Pair)
Description: 
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000">
   <title>SopInstance (DICOM Service Object Pair)</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.10.20.6.2.8
Context: *[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]
Item: (SopInstance)
-->

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

   <rule context="*[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']"
         id="tmp-r-25d83c95-bc48-4f52-aaac-1cd9605ffc73">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="string(@classCode)=('DGIMG')">(SopInstance): Der Wert von @classCode MUSS 'DGIMG' sein.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="string(@moodCode)=('EVN')">(SopInstance): Der Wert von @moodCode MUSS 'EVN' sein.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.10.20.6.2.8'])&gt;=1 ">(SopInstance): Element hl7:templateId[@root='2.16.840.1.113883.10.20.6.2.8'] ist required [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.10.20.6.2.8'])&lt;=1">(SopInstance): Element hl7:templateId[@root='2.16.840.1.113883.10.20.6.2.8'] kommt zu häufig vor [max 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:id)&gt;=1 ">(SopInstance): Element hl7:id ist required [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:id)&lt;=1">(SopInstance): Element hl7:id kommt zu häufig vor [max 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:code[@codeSystem='1.2.840.10008.2.6.1'])&gt;=1 and not(hl7:code[@codeSystem='1.2.840.10008.2.6.1']/@nullFlavor)">(SopInstance): Element hl7:code[@codeSystem='1.2.840.10008.2.6.1'] ist mandatory [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:code[@codeSystem='1.2.840.10008.2.6.1'])&lt;=1">(SopInstance): Element hl7:code[@codeSystem='1.2.840.10008.2.6.1'] kommt zu häufig vor [max 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:text)&lt;=1">(SopInstance): Element hl7:text kommt zu häufig vor [max 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:effectiveTime)&lt;=1">(SopInstance): Element hl7:effectiveTime kommt zu häufig vor [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.10.20.6.2.8
Context: *[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:templateId[@root='2.16.840.1.113883.10.20.6.2.8']
Item: (SopInstance)
-->

   <rule context="*[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:templateId[@root='2.16.840.1.113883.10.20.6.2.8']"
         id="tmp-r-ae45816e-ff21-4a14-855e-5ddf7e86a9d8">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.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)">(SopInstance): 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-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="string(@root)=('2.16.840.1.113883.10.20.6.2.8')">(SopInstance): Der Wert von @root MUSS '2.16.840.1.113883.10.20.6.2.8' sein.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.10.20.6.2.8
Context: *[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:id
Item: (SopInstance)
-->

   <rule context="*[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:id"
         id="tmp-r-c8e2b9ed-eb77-4104-9be1-49c976245ee8">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.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)">(SopInstance): 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-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="@root">(SopInstance): Attribut @root MUSS vorkommen.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="not(@extension)">(SopInstance): Attribut @extension DARF NICHT vorkommen.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.10.20.6.2.8
Context: *[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:code[@codeSystem='1.2.840.10008.2.6.1']
Item: (SopInstance)
-->

   <rule context="*[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:code[@codeSystem='1.2.840.10008.2.6.1']"
         id="tmp-r-a790bf23-32bf-4bad-a7d2-a118fe90b6e2">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(SopInstance): Wenn eine @xsi:type Instruktion anwesend ist MUSS diese den Wert "{urn:hl7-org:v3}:CD" 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="CD"/>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="@nullFlavor or (@codeSystem='1.2.840.10008.2.6.1' and @codeSystemName='DCMUID')">(SopInstance): Der Elementinhalt MUSS einer von 'codeSystem '1.2.840.10008.2.6.1' codeSystemName='DCMUID'' sein.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.10.20.6.2.8
Context: *[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:text
Item: (SopInstance)
-->

   <rule context="*[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:text"
         id="tmp-r-9f97c355-75b2-40b1-8415-308261b9e0ec">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.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)">(SopInstance): 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-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="string(@mediaType)=('application/dicom')">(SopInstance): Der Wert von @mediaType MUSS 'application/dicom' sein.</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:reference)&gt;=1 and not(hl7:reference/@nullFlavor)">(SopInstance): Element hl7:reference ist mandatory [min 1x].</assert>
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.html"
              test="count(hl7:reference)&lt;=1">(SopInstance): Element hl7:reference kommt zu häufig vor [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.10.20.6.2.8
Context: *[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:text/hl7:reference
Item: (SopInstance)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.10.20.6.2.8
Context: *[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:effectiveTime
Item: (SopInstance)
-->

   <rule context="*[hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']]/hl7:observation[hl7:templateId/@root='2.16.840.1.113883.10.20.6.2.8']/hl7:effectiveTime"
         id="tmp-r-5f43ec1b-20b6-4f2e-9f9c-c5784f57db1c">
      <assert role="error"
              see="http://elga.art-decor.org/elga-html-20150713T115013/tmp-2.16.840.1.113883.10.20.6.2.8-2012-01-12T000000.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)">(SopInstance): 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"/>
   </rule>
</pattern>
