<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.2.134
Name: [2] Dane wizyty na karcie medycznych czynności ratunkowych
Description: Szablon CDA dla danych o wizycie na karcie medycznych czynności ratunkowych
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.2.134-2025-02-26T000000">
   <title>[2] Dane wizyty na karcie medycznych czynności ratunkowych</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]"
         id="d16e3146-false-d15969e0">
      <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.2.134-2025-02-26T000000.html"
              test="count(hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]"
         id="d16e3221-false-d16100e0">
      <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.2.134-2025-02-26T000000.html"
              test="string(@typeCode) = ('COMP') or not(@typeCode)">(plCdaParamedicRescureSummaryNoteComponentOf): The value for typeCode SHALL be 'COMP'. 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.2.134-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']) &gt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134'] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134'] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]) &gt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]] is required [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.2.134-2025-02-26T000000.html"
              test="count(hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']"
         id="d16e3225-false-d16191e0">
      <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.2.134-2025-02-26T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.2.134')">(plCdaParamedicRescureSummaryNoteComponentOf): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.2.134'. Found: "<value-of select="@root"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]"
         id="d16e3230-false-d16263e0">
      <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.2.134-2025-02-26T000000.html"
              test="string(@classCode) = ('ENC') or not(@classCode)">(plCdaParamedicRescureSummaryNoteComponentOf): The value for classCode SHALL be 'ENC'. 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.2.134-2025-02-26T000000.html"
              test="string(@moodCode) = ('EVN') or not(@moodCode)">(plCdaParamedicRescureSummaryNoteComponentOf): 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.2.134-2025-02-26T000000.html"
              test="count(hl7:id[not(@nullFlavor)]) &gt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:id[not(@nullFlavor)] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]) &gt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:effectiveTime[not(@nullFlavor)]) &gt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:effectiveTime[not(@nullFlavor)] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:effectiveTime[not(@nullFlavor)]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:effectiveTime[not(@nullFlavor)] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:responsibleParty[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:responsibleParty[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:location[hl7:healthCareFacility]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:location[hl7:healthCareFacility] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:id[not(@nullFlavor)]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]"
         id="d16e3238-false-d16391e0">
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <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.2.134-2025-02-26T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1][conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem]])">(plCdaParamedicRescureSummaryNoteComponentOf): The element value SHALL be one of '2.16.840.1.113883.3.4424.13.11.228 Rodzaj zespołu ratunkowego (DYNAMIC)'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:effectiveTime[not(@nullFlavor)]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:effectiveTime[not(@nullFlavor)]"
         id="d16e3245-false-d16408e0">
      <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.2.134-2025-02-26T000000.html"
              test="not(@value) or matches(string(@value), '^[0-9]{4,14}')">(plCdaParamedicRescureSummaryNoteComponentOf): Attribute @value SHALL be of data type 'ts'  - '<value-of select="@value"/>'</assert>
      <report 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.2.134-2025-02-26T000000.html"
              test="not(@nullFlavor) and not(hl7:low) and not(hl7:high) and not(concat(substring(@value,1,4),'-',substring(@value,5,2),'-',substring(@value,7,2)) castable as xs:date)">(plCdaParamedicRescureSummaryNoteComponentOf): Pierwsze 8 cyfr daty powinno być w formacie YYYYMMDD.</report>
      <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.2.134-2025-02-26T000000.html"
              test="count(hl7:low) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:low 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.2.134-2025-02-26T000000.html"
              test="count(hl7:high) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:high appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:effectiveTime[not(@nullFlavor)]/hl7:low
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:effectiveTime[not(@nullFlavor)]/hl7:low"
         id="d16e3249-false-d16431e0">
      <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.2.134-2025-02-26T000000.html"
              test="@value">(plCdaParamedicRescureSummaryNoteComponentOf): attribute @value SHALL be present.</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.2.134-2025-02-26T000000.html"
              test="not(@value) or matches(string(@value), '^[0-9]{4,14}')">(plCdaParamedicRescureSummaryNoteComponentOf): Attribute @value SHALL be of data type 'ts'  - '<value-of select="@value"/>'</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.2.134-2025-02-26T000000.html"
              test="concat(substring(@value,1,4),'-',substring(@value,5,2),'-',substring(@value,7,2)) castable as xs:date">(plCdaParamedicRescureSummaryNoteComponentOf): Pierwsze 8 cyfr daty powinno być w formacie YYYYMMDD.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:effectiveTime[not(@nullFlavor)]/hl7:high
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:effectiveTime[not(@nullFlavor)]/hl7:high"
         id="d16e3257-false-d16444e0">
      <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.2.134-2025-02-26T000000.html"
              test="@value">(plCdaParamedicRescureSummaryNoteComponentOf): attribute @value SHALL be present.</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.2.134-2025-02-26T000000.html"
              test="not(@value) or matches(string(@value), '^[0-9]{4,14}')">(plCdaParamedicRescureSummaryNoteComponentOf): Attribute @value SHALL be of data type 'ts'  - '<value-of select="@value"/>'</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.2.134-2025-02-26T000000.html"
              test="concat(substring(@value,1,4),'-',substring(@value,5,2),'-',substring(@value,7,2)) castable as xs:date">(plCdaParamedicRescureSummaryNoteComponentOf): Pierwsze 8 cyfr daty powinno być w formacie YYYYMMDD.</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:responsibleParty[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->
   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:responsibleParty[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]">
      <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.2.134-2025-02-26T000000.html"
              test="string(@typeCode) = ('RESP') or not(@typeCode)">(plCdaParamedicRescureSummaryNoteComponentOf): The value for typeCode SHALL be 'RESP'. Found: "<value-of select="@typeCode"/>"</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:encounterParticipant[hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:encounterParticipant[hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]]"
         id="d16e3275-false-d16518e0">
      <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.2.134-2025-02-26T000000.html"
              test="@typeCode">(plCdaParamedicRescureSummaryNoteComponentOf): attribute @typeCode SHALL be present.</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@typeCode),'\s'))"/>
      <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.2.134-2025-02-26T000000.html"
              test="not(@typeCode) or empty($theAttValue[not(. = (doc('include/voc-2.16.840.1.113883.1.11.19600-DYNAMIC.xml')/*/valueSet/conceptList/concept/@code))])">(plCdaParamedicRescureSummaryNoteComponentOf): The value for typeCode SHALL be selected from value set '2.16.840.1.113883.1.11.19600' x_EncounterParticipant (DYNAMIC).</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.2.134-2025-02-26T000000.html"
              test="count(hl7:time) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:time 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.2.134-2025-02-26T000000.html"
              test="count(hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]) &gt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:encounterParticipant[hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]]/hl7:time
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->


   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:encounterParticipant[hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]]/hl7:assignedEntity[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.49']]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]"
         id="d16e3287-false-d16635e0">
      <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.2.134-2025-02-26T000000.html"
              test="string(@typeCode) = ('LOC') or not(@typeCode)">(plCdaParamedicRescureSummaryNoteComponentOf): The value for typeCode SHALL be 'LOC'. 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.2.134-2025-02-26T000000.html"
              test="count(hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]) &gt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]/hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]/hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]"
         id="d16e3291-false-d16685e0">
      <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.2.134-2025-02-26T000000.html"
              test="string(@classCode) = ('SDLOC') or not(@classCode)">(plCdaParamedicRescureSummaryNoteComponentOf): The value for classCode SHALL be 'SDLOC'. 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.2.134-2025-02-26T000000.html"
              test="count(hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.1.11.17660-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem) or @nullFlavor]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.1.11.17660-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem) or @nullFlavor] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]) &gt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']] 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.2.134-2025-02-26T000000.html"
              test="count(hl7:serviceProviderOrganization[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.2']]) &lt;= 1">(plCdaParamedicRescureSummaryNoteComponentOf): element hl7:serviceProviderOrganization[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.2']] appears too often [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]/hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]/hl7:id
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]/hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]/hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.1.11.17660-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem) or @nullFlavor]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <rule fpi="RULC-1"
         context="*[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]/hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]/hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.1.11.17660-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem) or @nullFlavor]"
         id="d16e3297-false-d16751e0">
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <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.2.134-2025-02-26T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.1.11.17660-DYNAMIC.xml')//valueSet[1][conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem]])">(plCdaParamedicRescureSummaryNoteComponentOf): The element value SHALL be one of '2.16.840.1.113883.1.11.17660 ServiceDeliveryLocationRoleType (DYNAMIC)'.</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]/hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]/hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
-->

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.134
Context: *[hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]]/hl7:componentOf[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.134']]/hl7:encompassingEncounter[hl7:code[concat(@code, @codeSystem) = doc('include/voc-2.16.840.1.113883.3.4424.13.11.228-DYNAMIC.xml')//valueSet[1]/conceptList/concept/concat(@code, @codeSystem)]]/hl7:location[hl7:healthCareFacility]/hl7:healthCareFacility[hl7:location[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.75']]]/hl7:serviceProviderOrganization[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.2']]
Item: (plCdaParamedicRescureSummaryNoteComponentOf)
--></pattern>
