<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.281
Name: [4] KMCR VIe Załączniki
Description: KMCR VIe Załączniki
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.281-2025-02-26T000000">
   <title>[4] KMCR VIe Załączniki</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]"
         id="d16e12848-false-d49733e0">
      <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.281-2025-02-26T000000.html"
              test="count(hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]"
         id="d16e12925-false-d49750e0">
      <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.281-2025-02-26T000000.html"
              test="string(@classCode) = ('BATTERY')">(plCdaRescueDocumentAttachmentsEntry): The value for classCode SHALL be 'BATTERY'. Found: "<value-of select="@classCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN')">(plCdaRescueDocumentAttachmentsEntry): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281'] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281'] appears too often [max 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'KMCR_VIe' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = 'KMCR_VIe' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'KMCR_VIe' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = 'KMCR_VIe' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')] appears too often [max 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:statusCode[@code = 'completed'] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:statusCode[@code = 'completed']) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:statusCode[@code = 'completed'] appears too often [max 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5'] appears too often [max 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0'] appears too often [max 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3'] appears too often [max 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2'] appears too often [max 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:reference[hl7:externalDocument/hl7:code/@code='Inne']) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:reference[hl7:externalDocument/hl7:code/@code='Inne'] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']"
         id="d16e12931-false-d49814e0">
      <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.281-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.4.281')">(plCdaRescueDocumentAttachmentsEntry): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.4.281'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:code[(@code = 'KMCR_VIe' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:code[(@code = 'KMCR_VIe' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.1')]"
         id="d16e12936-false-d49826e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='KMCR_VIe' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.1' and @displayName='Załączniki' and @codeSystemName='WpisDoKMCR_KMLZRM')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code 'KMCR_VIe' codeSystem '2.16.840.1.113883.3.4424.13.5.30.1' displayName='Załączniki' codeSystemName='WpisDoKMCR_KMLZRM''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:statusCode[@code = 'completed']
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:statusCode[@code = 'completed']"
         id="d16e12941-false-d49840e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code 'completed''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']"
         id="d16e12947-false-d49851e0">
      <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.281-2025-02-26T000000.html"
              test="string(@typeCode) = ('REFR')">(plCdaRescueDocumentAttachmentsEntry): The value for typeCode SHALL be 'REFR'. Found: "<value-of select="@typeCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']/hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']/hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]]"
         id="d16e12951-false-d49873e0">
      <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.281-2025-02-26T000000.html"
              test="string(@classCode) = ('DOC') or not(@classCode)">(plCdaRescueDocumentAttachmentsEntry): The value for classCode SHALL be 'DOC'. Found: "<value-of select="@classCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN') or not(@moodCode)">(plCdaRescueDocumentAttachmentsEntry): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']/hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']/hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]"
         id="d16e12957-false-d49899e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='64297-5' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Death certificate' and @codeSystemName='LOINC')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code '64297-5' codeSystem '2.16.840.1.113883.6.1' displayName='Death certificate' codeSystemName='LOINC''.</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'KZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:translation[(@code = 'KZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'KZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:translation[(@code = 'KZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']/hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]/hl7:translation[(@code = 'KZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='64297-5']/hl7:externalDocument[hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '64297-5' and @codeSystem = '2.16.840.1.113883.6.1')]/hl7:translation[(@code = 'KZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]"
         id="d16e12961-false-d49922e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='KZ' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.2' and @displayName='Karta zgonu' and @codeSystemName='ZalacznikDoKMCR_KMLZRM')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code 'KZ' codeSystem '2.16.840.1.113883.3.4424.13.5.30.2' displayName='Karta zgonu' codeSystemName='ZalacznikDoKMCR_KMLZRM''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']"
         id="d16e12969-false-d49933e0">
      <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.281-2025-02-26T000000.html"
              test="string(@typeCode) = ('REFR')">(plCdaRescueDocumentAttachmentsEntry): The value for typeCode SHALL be 'REFR'. Found: "<value-of select="@typeCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']/hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']/hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]]"
         id="d16e12973-false-d49955e0">
      <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.281-2025-02-26T000000.html"
              test="string(@classCode) = ('DOC') or not(@classCode)">(plCdaRescueDocumentAttachmentsEntry): The value for classCode SHALL be 'DOC'. Found: "<value-of select="@classCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN') or not(@moodCode)">(plCdaRescueDocumentAttachmentsEntry): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']/hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']/hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]"
         id="d16e12979-false-d49981e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='70007-0' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Restraint note' and @codeSystemName='LOINC')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code '70007-0' codeSystem '2.16.840.1.113883.6.1' displayName='Restraint note' codeSystemName='LOINC''.</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'KPB' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:translation[(@code = 'KPB' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'KPB' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:translation[(@code = 'KPB' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']/hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]/hl7:translation[(@code = 'KPB' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='70007-0']/hl7:externalDocument[hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '70007-0' and @codeSystem = '2.16.840.1.113883.6.1')]/hl7:translation[(@code = 'KPB' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]"
         id="d16e12983-false-d50004e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='KPB' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.2' and @displayName='Karta przymusu bezpośredniego' and @codeSystemName='ZalacznikDoKMCR_KMLZRM')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code 'KPB' codeSystem '2.16.840.1.113883.3.4424.13.5.30.2' displayName='Karta przymusu bezpośredniego' codeSystemName='ZalacznikDoKMCR_KMLZRM''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']"
         id="d16e12991-false-d50015e0">
      <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.281-2025-02-26T000000.html"
              test="string(@typeCode) = ('REFR')">(plCdaRescueDocumentAttachmentsEntry): The value for typeCode SHALL be 'REFR'. Found: "<value-of select="@typeCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']/hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']/hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]]"
         id="d16e12995-false-d50037e0">
      <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.281-2025-02-26T000000.html"
              test="string(@classCode) = ('DOC') or not(@classCode)">(plCdaRescueDocumentAttachmentsEntry): The value for classCode SHALL be 'DOC'. Found: "<value-of select="@classCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN') or not(@moodCode)">(plCdaRescueDocumentAttachmentsEntry): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']/hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']/hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]"
         id="d16e13001-false-d50063e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='34782-3' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Infectious disease Note' and @codeSystemName='LOINC')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code '34782-3' codeSystem '2.16.840.1.113883.6.1' displayName='Infectious disease Note' codeSystemName='LOINC''.</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'KChZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:translation[(@code = 'KChZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'KChZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:translation[(@code = 'KChZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']/hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]/hl7:translation[(@code = 'KChZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='34782-3']/hl7:externalDocument[hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '34782-3' and @codeSystem = '2.16.840.1.113883.6.1')]/hl7:translation[(@code = 'KChZ' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]"
         id="d16e13005-false-d50086e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='KChZ' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.2' and @displayName='Karta chorób zakaźnych' and @codeSystemName='ZalacznikDoKMCR_KMLZRM')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code 'KChZ' codeSystem '2.16.840.1.113883.3.4424.13.5.30.2' displayName='Karta chorób zakaźnych' codeSystemName='ZalacznikDoKMCR_KMLZRM''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']"
         id="d16e13013-false-d50097e0">
      <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.281-2025-02-26T000000.html"
              test="string(@typeCode) = ('REFR')">(plCdaRescueDocumentAttachmentsEntry): The value for typeCode SHALL be 'REFR'. Found: "<value-of select="@typeCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']/hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']/hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]]"
         id="d16e13017-false-d50119e0">
      <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.281-2025-02-26T000000.html"
              test="string(@classCode) = ('DOC') or not(@classCode)">(plCdaRescueDocumentAttachmentsEntry): The value for classCode SHALL be 'DOC'. Found: "<value-of select="@classCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN') or not(@moodCode)">(plCdaRescueDocumentAttachmentsEntry): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']/hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']/hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]"
         id="d16e13023-false-d50145e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='103813-2' and @codeSystem='2.16.840.1.113883.6.1' and @displayName='Domestic violence screening report' and @codeSystemName='LOINC')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code '103813-2' codeSystem '2.16.840.1.113883.6.1' displayName='Domestic violence screening report' codeSystemName='LOINC''.</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'NK' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:translation[(@code = 'NK' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:translation[(@code = 'NK' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:translation[(@code = 'NK' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']/hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]/hl7:translation[(@code = 'NK' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='103813-2']/hl7:externalDocument[hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]]/hl7:code[(@code = '103813-2' and @codeSystem = '2.16.840.1.113883.6.1')]/hl7:translation[(@code = 'NK' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]"
         id="d16e13027-false-d50168e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='NK' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.2' and @displayName='Niebieska karta' and @codeSystemName='ZalacznikDoKMCR_KMLZRM')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code 'NK' codeSystem '2.16.840.1.113883.3.4424.13.5.30.2' displayName='Niebieska karta' codeSystemName='ZalacznikDoKMCR_KMLZRM''.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='Inne']
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='Inne']"
         id="d16e13035-false-d50179e0">
      <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.281-2025-02-26T000000.html"
              test="string(@typeCode) = ('REFR')">(plCdaRescueDocumentAttachmentsEntry): The value for typeCode SHALL be 'REFR'. Found: "<value-of select="@typeCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:externalDocument[hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:externalDocument[hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='Inne']/hl7:externalDocument[hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='Inne']/hl7:externalDocument[hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]]"
         id="d16e13039-false-d50201e0">
      <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.281-2025-02-26T000000.html"
              test="string(@classCode) = ('DOC') or not(@classCode)">(plCdaRescueDocumentAttachmentsEntry): The value for classCode SHALL be 'DOC'. Found: "<value-of select="@classCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN') or not(@moodCode)">(plCdaRescueDocumentAttachmentsEntry): The value for moodCode SHALL be 'EVN'. Found: "<value-of select="@moodCode"/>"</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &gt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] is mandatory [min 1x].</assert>
      <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.281-2025-02-26T000000.html"
              test="count(hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]) &lt;= 1">(plCdaRescueDocumentAttachmentsEntry): element hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.281
Context: *[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='Inne']/hl7:externalDocument[hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]]/hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]
Item: (plCdaRescueDocumentAttachmentsEntry)
-->

   <rule fpi="RULC-1"
         context="*[hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]]/hl7:organizer[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.4.281']]/hl7:reference[hl7:externalDocument/hl7:code/@code='Inne']/hl7:externalDocument[hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]]/hl7:code[(@code = 'Inne' and @codeSystem = '2.16.840.1.113883.3.4424.13.5.30.2')]"
         id="d16e13045-false-d50227e0">
      <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.281-2025-02-26T000000.html"
              test="@nullFlavor or (@code='Inne' and @codeSystem='2.16.840.1.113883.3.4424.13.5.30.2' and @displayName='Inne' and @codeSystemName='ZalacznikDoKMCR_KMLZRM')">(plCdaRescueDocumentAttachmentsEntry): The element value SHALL be one of 'code 'Inne' codeSystem '2.16.840.1.113883.3.4424.13.5.30.2' displayName='Inne' codeSystemName='ZalacznikDoKMCR_KMLZRM''.</assert>
   </rule>
</pattern>
