<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.4.180
Name: [4] Opis mikroskopowy w cytologii dla pojedynczego badanego materiału
Description: Szablon CDA dla opisu mikroskopowego w cytologii dla pojedynczego badanego materiału
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000">
   <title>[4] Opis mikroskopowy w cytologii dla pojedynczego badanego materiału</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180'])&gt;=1 and not(hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@classCode)='BATTERY'">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @classCode MUSI wynosić 'BATTERY'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@moodCode)='EVN'">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.4.180'])&gt;=1 and not(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.4.180']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.4.180'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.4.180'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.4.180'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code)&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <let name="elmcount"
           value="count(hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']|hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']|hl7:component[hl7:observation/hl7:code/@nullFlavor='NA'])"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="$elmcount&gt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): wybór (hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas'] lub hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas'] lub hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']) zawiera zbyt mało elementów [min 1x]</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="$elmcount&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): wybór (hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas'] lub hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas'] lub hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']) zawiera zbyt dużo elementów [min 1x]</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:component[hl7:observation/hl7:code/@nullFlavor='NA'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:component[hl7:observation/hl7:code/@nullFlavor='NA'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.4.180']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.4.180']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.13.10.4.180'">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.13.10.4.180'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @root MUSI być typu 'oid'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:code
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:code"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@nullFlavor) or (string-length(@nullFlavor)&gt;0 and not(matches(@nullFlavor,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @nullFlavor MUSI być typu 'cs'</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@nullFlavor),' '))"/>
      <let name="theAttCheck"
           value="distinct-values(for $code in tokenize(@nullFlavor,' ') return if ($code=('NA')) then ($code) else ())"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@nullFlavor) or count($theAttValue) = count($theAttCheck)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla nullFlavor MUSI wynosić 'kod NA'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:statusCode[@code='completed']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @typeCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@classCode)='OBS' or not(@classCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@moodCode)='EVN' or not(@moodCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:text)&gt;=1 and not(hl7:text/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:text jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182'])&gt;=1 and not(hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or (@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Parametry materiału w opisie mikroskopowym z wykorzystaniem międzynarodowej klasyfikacji' and @codeSystemName='AtrybutyWBCYT')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić code 'ParamMatMikroZWykoMiedzKlas' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Parametry materiału w opisie mikroskopowym z wykorzystaniem międzynarodowej klasyfikacji' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->
   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroZWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroZWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182']">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @typeCode MUSI być typu 'cs'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @typeCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@classCode)='OBS' or not(@classCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@moodCode)='EVN' or not(@moodCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:text)&gt;=1 and not(hl7:text/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:text jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro'])&gt;=1 and not(hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182'])&gt;=1 and not(hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or (@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Parametry materiału w opisie mikroskopowym bez wykorzystania międzynarodowej klasyfikacji' and @codeSystemName='AtrybutyWBCYT')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić code 'ParamMatMikroBezWykoMiedzKlas' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Parametry materiału w opisie mikroskopowym bez wykorzystania międzynarodowej klasyfikacji' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @typeCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&gt;=1 and not(hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@classCode)='OBS' or not(@classCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@moodCode)='EVN' or not(@moodCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&gt;=1 and not(hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:text)&gt;=1 and not(hl7:text/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:text jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)])&gt;=1 and not(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or (@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18' and @displayName='Kwalifikacja materiału do oceny mikroskopowej bez wykorzystania międzynarodowej klasyfikacji' and @codeSystemName='AtrybutyWBCYT')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić code 'KwalMatDoOceMikro' codeSystem '2.16.840.1.113883.3.4424.13.5.18' displayName='Kwalifikacja materiału do oceny mikroskopowej bez wykorzystania międzynarodowej klasyfikacji' codeSystemName='AtrybutyWBCYT'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:code/@code='KwalMatDoOceMikro']/hl7:observation[hl7:code[(@code='KwalMatDoOceMikro' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:value[concat(@code,@codeSystem)=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/concept/concat(@code,@codeSystem) or (@nullFlavor=doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/exception/@code)]"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <let name="theCode" value="@code"/>
      <let name="theCodeSystem" value="@codeSystem"/>
      <let name="theCodeSystemVersion" value="@codeSystemVersion"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet[conceptList/concept[@code = $theCode][@codeSystem = $theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion] or completeCodeSystem[@codeSystem=$theCodeSystem][not(@codeSystemVersion) or @codeSystemVersion=$theCodeSystemVersion]])">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić CytologiaKwalifikacjaMaterialuDoOcenyMikroskopowejBezWykorzystaniaMiedzynarodowejKlasyfikacji Kwalifikacja materiału do oceny mikroskopowej bez wykorzystania międzynarodowej klasyfikacji w cytologii (DYNAMICZNE).</assert>
      <let name="theNullFlavor" value="@nullFlavor"/>
      <let name="validNullFlavorsFound"
           value="exists(doc('include/voc-2.16.840.1.113883.3.4424.13.11.186-DYNAMIC.xml')/*/valueSet/conceptList/exception[@code = $theNullFlavor][@codeSystem = '2.16.840.1.113883.5.1008'])"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@nullFlavor) or not(empty(($validNullFlavorsFound))) ">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Kod braku danych dla @code MUSI pochodzić ze zbioru dopuszczalnych kodów braku danych zdefiniowanych dla tego atrybutu lub powiązanych ze zbiorem wartości CytologiaKwalifikacjaMaterialuDoOcenyMikroskopowejBezWykorzystaniaMiedzynarodowejKlasyfikacji Kwalifikacja materiału do oceny mikroskopowej bez wykorzystania międzynarodowej klasyfikacji w cytologii (DYNAMICZNE)</assert>
   </rule>

   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->
   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@code='ParamMatMikroBezWykoMiedzKlas']/hl7:observation[hl7:code[(@code='ParamMatMikroBezWykoMiedzKlas' and @codeSystem='2.16.840.1.113883.3.4424.13.5.18')]]/hl7:entryRelationship[hl7:observation/hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.182']">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @typeCode MUSI być typu 'cs'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@typeCode)='COMP' or not(@typeCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @typeCode MUSI wynosić 'COMP'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@typeCode) or (string-length(@typeCode)&gt;0 and not(matches(@typeCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @typeCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:observation)&gt;=1 and not(hl7:observation/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:observation jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:observation)&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:observation występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']/hl7:observation
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']/hl7:observation"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@classCode)='OBS' or not(@classCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @classCode MUSI wynosić 'OBS'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@classCode) or (string-length(@classCode)&gt;0 and not(matches(@classCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @classCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="string(@moodCode)='EVN' or not(@moodCode)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla @moodCode MUSI wynosić 'EVN'.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@moodCode) or (string-length(@moodCode)&gt;0 and not(matches(@moodCode,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @moodCode MUSI być typu 'cs'</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code)&gt;=1 ">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code jest required [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:code)&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:code występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:text)&gt;=1 and not(hl7:text/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:text jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:text)&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:text występuje zbyt często [max 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&gt;=1 and not(hl7:statusCode[@code='completed']/@nullFlavor)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] jest mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="count(hl7:statusCode[@code='completed'])&lt;=1">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): element hl7:statusCode[@code='completed'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']/hl7:observation/hl7:code
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']/hl7:observation/hl7:code"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CD' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CD", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CD"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): atrybut @nullFlavor MUSI wystąpić.</assert>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@nullFlavor) or (string-length(@nullFlavor)&gt;0 and not(matches(@nullFlavor,'\s')))">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Atrybut @nullFlavor MUSI być typu 'cs'</assert>
      <let name="theAttValue"
           value="distinct-values(tokenize(normalize-space(@nullFlavor),' '))"/>
      <let name="theAttCheck"
           value="distinct-values(for $code in tokenize(@nullFlavor,' ') return if ($code=('NA')) then ($code) else ())"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="not(@nullFlavor) or count($theAttValue) = count($theAttCheck)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość dla nullFlavor MUSI wynosić 'kod NA'.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.4.180
Context: *[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']/hl7:observation/hl7:statusCode[@code='completed']
Item: (plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry)
-->

   <rule context="*[hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']]/hl7:organizer[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.4.180']/hl7:component[hl7:observation/hl7:code/@nullFlavor='NA']/hl7:observation/hl7:statusCode[@code='completed']"
         id="tmp-">
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CS", znaleziono "{<value-of select="namespace-uri-from-QName(resolve-QName(@xsi:type,.))"/>}:<value-of select="local-name-from-QName(resolve-QName(@xsi:type,.))"/>"</assert>
      <extends rule="CS"/>
      <let name="theValue" value="@value"/>
      <assert role="error"
              see="https://www.cez.gov.pl/HL7POL-1.3.2/plcda-html-1.3.2/plcda-html/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.4.180-2023-04-27T000000.html"
              test="@nullFlavor or (@code='completed')">(plCdaMicroscopicDescriptionInCytologyPerExaminedMaterialEntry): Wartość elementu MUSI wynosić code 'completed'.</assert>
   </rule>
</pattern>
