<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.278
Name: [4] KMCR Vd Osoba do kontaktu
Description: KMCR Vd Osoba do kontaktu
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.278-2025-02-26T000000-closed">
   <title>[4] KMCR Vd Osoba do kontaktu</title>

   <!-- Checking undefined contents for template/element @isClosed="true". Match context that we did not already match -->
   <rule fpi="RUL-QQQ"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/*[not(@xsi:nil = 'true')][not(self::hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']])]"
         id="d16e12320-true-d48194e0">
      <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.278-2025-02-26T000000.html"
              test="not(.)">(plCdaRescueContactPersonEntry)/d16e12320-true-d48194e0: '<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:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']] (rule-reference: d16e12320-true-d48194e0)</assert>
   </rule>

   <!-- Checking undefined contents for template/element @isClosed="true". Match context that we did not already match -->
   <rule fpi="RUL-QQQ"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/*[not(@xsi:nil = 'true')][not(self::hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278'] | self::hl7:code[(@code = 'KMCR_Vd' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')] | self::hl7:statusCode[@code = 'completed'] | self::hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole])]"
         id="d16e12359-true-d48230e0">
      <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.278-2025-02-26T000000.html"
              test="not(.)">(plCdaRescueContactPersonEntry)/d16e12359-true-d48230e0: '<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.278'] | hl7:code[(@code = 'KMCR_Vd' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')] | hl7:statusCode[@code = 'completed'] | hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole] (rule-reference: d16e12359-true-d48230e0)</assert>
   </rule>

   <!-- Checking undefined contents for template/element @isClosed="true". Match context that we did not already match -->
   <rule fpi="RUL-QQQ"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/*[not(@xsi:nil = 'true')][not(self::hl7:participantRole[not(@nullFlavor)][hl7:playingEntity])]"
         id="d16e12381-true-d48262e0">
      <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.278-2025-02-26T000000.html"
              test="not(.)">(plCdaRescueContactPersonEntry)/d16e12381-true-d48262e0: '<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:participantRole[not(@nullFlavor)][hl7:playingEntity] (rule-reference: d16e12381-true-d48262e0)</assert>
   </rule>

   <!-- Checking undefined contents for template/element @isClosed="true". Match context that we did not already match -->
   <rule fpi="RUL-QQQ"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]/*[not(@xsi:nil = 'true')][not(self::hl7:playingEntity[not(@nullFlavor)])]"
         id="d16e12385-true-d48276e0">
      <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.278-2025-02-26T000000.html"
              test="not(.)">(plCdaRescueContactPersonEntry)/d16e12385-true-d48276e0: '<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:playingEntity[not(@nullFlavor)] (rule-reference: d16e12385-true-d48276e0)</assert>
   </rule>

   <!-- Checking undefined contents for template/element @isClosed="true". Match context that we did not already match -->
   <rule fpi="RUL-QQQ"
         context="*[hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]]/hl7:act[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.278']]/hl7:participant[not(@nullFlavor)][@typeCode = 'INF'][hl7:participantRole]/hl7:participantRole[not(@nullFlavor)][hl7:playingEntity]/hl7:playingEntity[not(@nullFlavor)]/*[not(@xsi:nil = 'true')][not(self::hl7:name[not(@nullFlavor)] | self::hl7:desc[not(@nullFlavor)])]"
         id="d16e12389-true-d48295e0">
      <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.278-2025-02-26T000000.html"
              test="not(.)">(plCdaRescueContactPersonEntry)/d16e12389-true-d48295e0: '<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:name[not(@nullFlavor)] | hl7:desc[not(@nullFlavor)] (rule-reference: d16e12389-true-d48295e0)</assert>
   </rule>
</pattern>
