<?xml version="1.0" encoding="UTF-8"?>
<!--
Template derived pattern
===========================================
ID: 2.16.840.1.113883.3.4424.13.10.2.18
Name: [2] Komórka podmiotu wykonującego działalność leczniczą (bazowy)
Description: Bazowy szablon struktury CDA dla komórki organizacyjnej podmiotu wykonującego działalność leczniczą
-->
<pattern xmlns="http://purl.oclc.org/dsdl/schematron"
         id="template-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000">
   <title>[2] Komórka podmiotu wykonującego działalność leczniczą (bazowy)</title>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.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.2.18-2018-06-30T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.18'])&gt;=1 and not(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.18']/@nullFlavor)">(plCdaBaseOrganizationalCell): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.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.2.18-2018-06-30T000000.html"
              test="count(hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.18'])&lt;=1">(plCdaBaseOrganizationalCell): element hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.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.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.2.3.3'])&gt;=1 and not(hl7:id[@root='2.16.840.1.113883.3.4424.2.3.3']/@nullFlavor)">(plCdaBaseOrganizationalCell): element hl7:id[@root='2.16.840.1.113883.3.4424.2.3.3'] 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.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.2.3.3'])&lt;=1">(plCdaBaseOrganizationalCell): element hl7:id[@root='2.16.840.1.113883.3.4424.2.3.3'] 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.2.18-2018-06-30T000000.html"
              test="count(hl7:name)&gt;=1 ">(plCdaBaseOrganizationalCell): element hl7:name 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.2.18-2018-06-30T000000.html"
              test="count(hl7:name)&lt;=1">(plCdaBaseOrganizationalCell): element hl7:name 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.2.18-2018-06-30T000000.html"
              test="count(hl7:telecom)&gt;=1 ">(plCdaBaseOrganizationalCell): element hl7:telecom 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.2.18-2018-06-30T000000.html"
              test="count(hl7:telecom)&lt;=1">(plCdaBaseOrganizationalCell): element hl7:telecom 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.2.18-2018-06-30T000000.html"
              test="count(hl7:addr)&gt;=1 ">(plCdaBaseOrganizationalCell): element hl7:addr 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.2.18-2018-06-30T000000.html"
              test="count(hl7:addr)&lt;=1">(plCdaBaseOrganizationalCell): element hl7:addr 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.2.18-2018-06-30T000000.html"
              test="count(hl7:standardIndustryClassCode)&lt;=1">(plCdaBaseOrganizationalCell): element hl7:standardIndustryClassCode 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.2.18-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf)&gt;=1 and not(hl7:asOrganizationPartOf/@nullFlavor)">(plCdaBaseOrganizationalCell): element hl7:asOrganizationPartOf 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.2.18-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf)&lt;=1">(plCdaBaseOrganizationalCell): element hl7:asOrganizationPartOf występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.18']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:templateId[@root='2.16.840.1.113883.3.4424.13.10.2.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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", 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="II"/>
      <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.2.18-2018-06-30T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.13.10.2.18'">(plCdaBaseOrganizationalCell): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.13.10.2.18'.</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.2.18-2018-06-30T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaBaseOrganizationalCell): Atrybut @root MUSI być typu 'oid'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:id[@root='2.16.840.1.113883.3.4424.2.3.3']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:id[@root='2.16.840.1.113883.3.4424.2.3.3']"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", 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="II"/>
      <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.2.18-2018-06-30T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.2.3.3'">(plCdaBaseOrganizationalCell): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.2.3.3'.</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.2.18-2018-06-30T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaBaseOrganizationalCell): Atrybut @root MUSI być typu 'oid'</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.2.18-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalCell): atrybut @extension 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.2.18-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalCell): Atrybut @extension MUSI być typu 'st'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:name
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:name"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='ON' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:ON", 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="ON"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:telecom
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:telecom"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='TEL' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:TEL", 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="TEL"/>
      <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.2.18-2018-06-30T000000.html"
              test="string-length(@value)&gt;0">(plCdaBaseOrganizationalCell): Wartość dla telefonu, adresu email lub lokalizacji zasobu nie może by pusta.</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:standardIndustryClassCode
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:standardIndustryClassCode"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CE' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CE", 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="CE"/>
      <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.2.18-2018-06-30T000000.html"
              test="@nullFlavor or (@codeSystem='2.16.840.1.113883.3.4424.11.2.4')">(plCdaBaseOrganizationalCell): Wartość elementu MUSI wynosić codeSystem '2.16.840.1.113883.3.4424.11.2.4'.</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.2.18-2018-06-30T000000.html"
              test="@code">(plCdaBaseOrganizationalCell): atrybut @code 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.2.18-2018-06-30T000000.html"
              test="not(@code) or (string-length(@code)&gt;0 and not(matches(@code,'\s')))">(plCdaBaseOrganizationalCell): Atrybut @code 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.2.18-2018-06-30T000000.html"
              test="@displayName">(plCdaBaseOrganizationalCell): atrybut @displayName 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.2.18-2018-06-30T000000.html"
              test="not(@displayName) or string-length(@displayName)&gt;0">(plCdaBaseOrganizationalCell): Atrybut @displayName MUSI być typu 'st'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf"
         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.2.18-2018-06-30T000000.html"
              test="string(@classCode)='PART' or not(@classCode)">(plCdaBaseOrganizationalCell): Wartość dla @classCode MUSI wynosić 'PART'.</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.2.18-2018-06-30T000000.html"
              test="count(hl7:id)=0">(plCdaBaseOrganizationalCell): element hl7:id NIE MOŻE 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.2.18-2018-06-30T000000.html"
              test="count(hl7:code)=0">(plCdaBaseOrganizationalCell): element hl7:code NIE MOŻE 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.2.18-2018-06-30T000000.html"
              test="count(hl7:statusCode)=0">(plCdaBaseOrganizationalCell): element hl7:statusCode NIE MOŻE 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.2.18-2018-06-30T000000.html"
              test="count(hl7:effectiveTime)=0">(plCdaBaseOrganizationalCell): element hl7:effectiveTime NIE MOŻE wystąpić.</assert>
      <let name="elmcount"
           value="count(hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']|hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2'])"/>
      <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.2.18-2018-06-30T000000.html"
              test="$elmcount&gt;=1">(plCdaBaseOrganizationalCell): wybór (hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2'] lub hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']) 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.2.18-2018-06-30T000000.html"
              test="$elmcount&lt;=1">(plCdaBaseOrganizationalCell): wybór (hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2'] lub hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']) 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.2.18-2018-06-30T000000.html"
              test="count(hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2'])&lt;=1">(plCdaBaseOrganizationalCell): element hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2'] 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.2.18-2018-06-30T000000.html"
              test="count(hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2'])&lt;=1">(plCdaBaseOrganizationalCell): element hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:id
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:id"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", 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="II"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:code
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CE' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CE", 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="CE"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:statusCode
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:statusCode"
         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.2.18-2018-06-30T000000.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)">(plCdaBaseOrganizationalCell): 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"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:effectiveTime
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:effectiveTime"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='IVL_TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:IVL_TS", 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="IVL_TS"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']"
         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.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.2.3.2'])&gt;=1 and not(hl7:id[@root='2.16.840.1.113883.3.4424.2.3.2']/@nullFlavor)">(plCdaBaseOrganizationalCell): element hl7:id[@root='2.16.840.1.113883.3.4424.2.3.2'] 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.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.2.3.2'])&lt;=1">(plCdaBaseOrganizationalCell): element hl7:id[@root='2.16.840.1.113883.3.4424.2.3.2'] 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.2.18-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf)&gt;=1 and not(hl7:asOrganizationPartOf/@nullFlavor)">(plCdaBaseOrganizationalCell): element hl7:asOrganizationPartOf 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.2.18-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf)&lt;=1">(plCdaBaseOrganizationalCell): element hl7:asOrganizationPartOf występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:id[@root='2.16.840.1.113883.3.4424.2.3.2']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:id[@root='2.16.840.1.113883.3.4424.2.3.2']"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", 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="II"/>
      <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.2.18-2018-06-30T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.2.3.2'">(plCdaBaseOrganizationalCell): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.2.3.2'.</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.2.18-2018-06-30T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaBaseOrganizationalCell): Atrybut @root MUSI być typu 'oid'</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.2.18-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalCell): atrybut @extension 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.2.18-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalCell): Atrybut @extension MUSI być typu 'st'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf"
         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.2.18-2018-06-30T000000.html"
              test="string(@classCode)='PART' or not(@classCode)">(plCdaBaseOrganizationalCell): Wartość dla @classCode MUSI wynosić 'PART'.</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.2.18-2018-06-30T000000.html"
              test="count(hl7:id)=0">(plCdaBaseOrganizationalCell): element hl7:id NIE MOŻE 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.2.18-2018-06-30T000000.html"
              test="count(hl7:code)=0">(plCdaBaseOrganizationalCell): element hl7:code NIE MOŻE 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.2.18-2018-06-30T000000.html"
              test="count(hl7:statusCode)=0">(plCdaBaseOrganizationalCell): element hl7:statusCode NIE MOŻE 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.2.18-2018-06-30T000000.html"
              test="count(hl7:effectiveTime)=0">(plCdaBaseOrganizationalCell): element hl7:effectiveTime NIE MOŻE 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.2.18-2018-06-30T000000.html"
              test="count(hl7:wholeOrganization)&gt;=1 and not(hl7:wholeOrganization/@nullFlavor)">(plCdaBaseOrganizationalCell): element hl7:wholeOrganization 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.2.18-2018-06-30T000000.html"
              test="count(hl7:wholeOrganization)&lt;=1">(plCdaBaseOrganizationalCell): element hl7:wholeOrganization występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:id
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:id"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", 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="II"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:code
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='CE' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:CE", 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="CE"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:statusCode
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:statusCode"
         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.2.18-2018-06-30T000000.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)">(plCdaBaseOrganizationalCell): 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"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:effectiveTime
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:effectiveTime"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='IVL_TS' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:IVL_TS", 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="IVL_TS"/>
      <let name="theValue" value="@value"/>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:wholeOrganization
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:wholeOrganization"
         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.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2'])&gt;=1 and not(hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2']/@nullFlavor)">(plCdaBaseOrganizationalCell): element hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2'] 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.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2'])&lt;=1">(plCdaBaseOrganizationalCell): element hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:wholeOrganization/hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf/hl7:wholeOrganization/hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2']"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", 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="II"/>
      <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.2.18-2018-06-30T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.2.2.2'">(plCdaBaseOrganizationalCell): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.2.2.2'.</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.2.18-2018-06-30T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaBaseOrganizationalCell): Atrybut @root MUSI być typu 'oid'</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.2.18-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalCell): atrybut @extension 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.2.18-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalCell): Atrybut @extension MUSI być typu 'st'</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']"
         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.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2'])&gt;=1 and not(hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2']/@nullFlavor)">(plCdaBaseOrganizationalCell): element hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2'] 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.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2'])&lt;=1">(plCdaBaseOrganizationalCell): element hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2'] występuje zbyt często [max 1x].</assert>
   </rule>
   <!--
Template derived rules for ID: 2.16.840.1.113883.3.4424.13.10.2.18
Context: *[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']/hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule context="*[hl7:templateId/@root='2.16.840.1.113883.3.4424.13.10.2.18']/hl7:asOrganizationPartOf/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']/hl7:id[@root='2.16.840.1.113883.3.4424.2.2.2']"
         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.2.18-2018-06-30T000000.html"
              test="(local-name-from-QName(resolve-QName(@xsi:type,.))='II' and namespace-uri-from-QName(resolve-QName(@xsi:type,.))='urn:hl7-org:v3') or not(@xsi:type)">(plCdaBaseOrganizationalCell): Jeśli występuje instrukcja @xsi:type, to MUSI mieć wartość "{urn:hl7-org:v3}:II", 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="II"/>
      <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.2.18-2018-06-30T000000.html"
              test="string(@root)='2.16.840.1.113883.3.4424.2.2.2'">(plCdaBaseOrganizationalCell): Wartość dla @root MUSI wynosić '2.16.840.1.113883.3.4424.2.2.2'.</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.2.18-2018-06-30T000000.html"
              test="not(@root) or matches(@root,'^[0-2](\.(0|[1-9][0-9]*))*$')">(plCdaBaseOrganizationalCell): Atrybut @root MUSI być typu 'oid'</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.2.18-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalCell): atrybut @extension 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.2.18-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalCell): Atrybut @extension MUSI być typu 'st'</assert>
   </rule>
</pattern>
