<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.49
Name: [4] Dokument w postaci binarnej
Description: Szablon CDA dla dokumentu w postaci binarnej
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.49-2018-06-30T000000-closed">
   <title>[4] Dokument w postaci binarnej</title>

   <!-- Checking undefined contents for template/element @isClosed="true". Match context that we did not already match -->
   <rule fpi="RUL-QQQ"
         context="*[hl7:observationMedia[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49']]]/*[not(@xsi:nil = 'true')][not(self::hl7:observationMedia[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49']])]"
         id="d16e5261-true-d22874e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.49-2018-06-30T000000.html"
              test="not(.)">(plCdaDocumentBinaryContentEntry)/d16e5261-true-d22874e0: '<value-of select="name(..)"/>' is defined as closed, and this element '<name/>' is not allowed, or not allowed with this content. This may concern the templateId, code or id. Expected in this context:  hl7:observationMedia[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49']] (rule-reference: d16e5261-true-d22874e0)</assert>
   </rule>

   <!-- Checking undefined contents for template/element @isClosed="true". Match context that we did not already match -->
   <rule fpi="RUL-QQQ"
         context="*[hl7:observationMedia[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49']]]/hl7:observationMedia[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49']]/*[not(@xsi:nil = 'true')][not(self::hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49'] | self::hl7:id | self::hl7:value[not(@nullFlavor)])]"
         id="d16e5285-true-d22901e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.49-2018-06-30T000000.html"
              test="not(.)">(plCdaDocumentBinaryContentEntry)/d16e5285-true-d22901e0: '<value-of select="name(..)"/>' is defined as closed, and this element '<name/>' is not allowed, or not allowed with this content. This may concern the templateId, code or id. Expected in this context:  hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49'] | hl7:id | hl7:value[not(@nullFlavor)] (rule-reference: d16e5285-true-d22901e0)</assert>
   </rule>

   <!-- Checking undefined contents for template/element @isClosed="true". Match context that we did not already match -->
   <rule fpi="RUL-QQQ"
         context="*[hl7:observationMedia[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49']]]/hl7:observationMedia[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.49']]/hl7:value[not(@nullFlavor)]/*[not(@xsi:nil = 'true')][not(self::hl7:reference)]"
         id="d16e5301-true-d22926e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.49-2018-06-30T000000.html"
              test="not(.)">(plCdaDocumentBinaryContentEntry)/d16e5301-true-d22926e0: '<value-of select="name(..)"/>' is defined as closed, and this element '<name/>' is not allowed, or not allowed with this content. This may concern the templateId, code or id. Expected in this context:  hl7:reference (rule-reference: d16e5301-true-d22926e0)</assert>
   </rule>
</pattern>
