<?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 fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]"
         id="d16e2237-false-d13717e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.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'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.3']) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.3'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.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'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:name) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:name is required [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:name) &lt;= 1">(plCdaBaseOrganizationalCell): element hl7:name appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:telecom) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:telecom is required [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:telecom) &lt;= 1">(plCdaBaseOrganizationalCell): element hl7:telecom appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:standardIndustryClassCode[@codeSystem = '2.16.840.1.113883.3.4424.11.2.4']) &lt;= 1">(plCdaBaseOrganizationalCell): element hl7:standardIndustryClassCode[@codeSystem = '2.16.840.1.113883.3.4424.11.2.4'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf[not(@nullFlavor)]) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:asOrganizationPartOf[not(@nullFlavor)] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf[not(@nullFlavor)]) &lt;= 1">(plCdaBaseOrganizationalCell): element hl7:asOrganizationPartOf[not(@nullFlavor)] appears too often [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 fpi="RULC-1"
         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="d16e2313-false-d13779e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.13.10.2.18')">(plCdaBaseOrganizationalCell): The value for root SHALL be '2.16.840.1.113883.3.4424.13.10.2.18'. Found: "<value-of select="@root"/>"</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 fpi="RULC-1"
         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="d16e2318-false-d13791e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.2.3.3')">(plCdaBaseOrganizationalCell): The value for root SHALL be '2.16.840.1.113883.3.4424.2.3.3'. Found: "<value-of select="@root"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalCell): attribute @extension SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalCell): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</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)
-->

   <!--
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 fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:telecom"
         id="d16e2328-false-d13816e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.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[@codeSystem = '2.16.840.1.113883.3.4424.11.2.4']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:standardIndustryClassCode[@codeSystem = '2.16.840.1.113883.3.4424.11.2.4']"
         id="d16e2336-false-d13825e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="@nullFlavor or (@codeSystem='2.16.840.1.113883.3.4424.11.2.4')">(plCdaBaseOrganizationalCell): The element value SHALL be one of 'codeSystem '2.16.840.1.113883.3.4424.11.2.4''.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="@code">(plCdaBaseOrganizationalCell): attribute @code SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="not(@code) or (string-length(@code) &gt; 0 and not(matches(@code,'\s')))">(plCdaBaseOrganizationalCell): Attribute @code SHALL be of data type 'cs'  - '<value-of select="@code"/>'</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="@displayName">(plCdaBaseOrganizationalCell): attribute @displayName SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="not(@displayName) or string-length(@displayName)&gt;0">(plCdaBaseOrganizationalCell): Attribute @displayName SHALL be of data type 'st'  - '<value-of select="@displayName"/>'</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[not(@nullFlavor)]
Item: (plCdaBaseOrganizationalCell)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:asOrganizationPartOf[not(@nullFlavor)]"
         id="d16e2345-false-d13848e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="string(@classCode) = ('PART') or not(@classCode)">(plCdaBaseOrganizationalCell): The value for classCode SHALL be 'PART'. Found: "<value-of select="@classCode"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:id) = 0">(plCdaBaseOrganizationalCell): element hl7:id MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:code) = 0">(plCdaBaseOrganizationalCell): element hl7:code MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:statusCode) = 0">(plCdaBaseOrganizationalCell): element hl7:statusCode MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:effectiveTime) = 0">(plCdaBaseOrganizationalCell): element hl7:effectiveTime MAY NOT be present.</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.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="$elmcount &gt;= 1">(plCdaBaseOrganizationalCell): choice (hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']  or  hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']) does not contain enough elements [min 1x]</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="$elmcount &lt;= 1">(plCdaBaseOrganizationalCell): choice (hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']  or  hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']) contains too many elements [max 1x]</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.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'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.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'] appears too often [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[not(@nullFlavor)]/hl7:id
Item: (plCdaBaseOrganizationalCell)
-->

   <!--
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[not(@nullFlavor)]/hl7:code
Item: (plCdaBaseOrganizationalCell)
-->

   <!--
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[not(@nullFlavor)]/hl7:statusCode
Item: (plCdaBaseOrganizationalCell)
-->

   <!--
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[not(@nullFlavor)]/hl7:effectiveTime
Item: (plCdaBaseOrganizationalCell)
-->

   <!--
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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:asOrganizationPartOf[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']"
         id="d16e2360-false-d13930e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.2']) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:id[@root = '2.16.840.1.113883.3.4424.2.3.2'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.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'] appears too often [max 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]) &lt;= 1">(plCdaBaseOrganizationalCell): element hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization] appears too often [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[not(@nullFlavor)]/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 fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:asOrganizationPartOf[not(@nullFlavor)]/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="d16e2362-false-d13956e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.2.3.2')">(plCdaBaseOrganizationalCell): The value for root SHALL be '2.16.840.1.113883.3.4424.2.3.2'. Found: "<value-of select="@root"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalCell): attribute @extension SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalCell): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]
Item: (plCdaBaseOrganizationalCell)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:asOrganizationPartOf[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]"
         id="d16e2369-false-d13973e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="string(@classCode) = ('PART') or not(@classCode)">(plCdaBaseOrganizationalCell): The value for classCode SHALL be 'PART'. Found: "<value-of select="@classCode"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:id) = 0">(plCdaBaseOrganizationalCell): element hl7:id MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:code) = 0">(plCdaBaseOrganizationalCell): element hl7:code MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:statusCode) = 0">(plCdaBaseOrganizationalCell): element hl7:statusCode MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:effectiveTime) = 0">(plCdaBaseOrganizationalCell): element hl7:effectiveTime MAY NOT be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.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']] appears too often [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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:id
Item: (plCdaBaseOrganizationalCell)
-->

   <!--
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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:code
Item: (plCdaBaseOrganizationalCell)
-->

   <!--
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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:statusCode
Item: (plCdaBaseOrganizationalCell)
-->

   <!--
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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:effectiveTime
Item: (plCdaBaseOrganizationalCell)
-->

   <!--
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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]
Item: (plCdaBaseOrganizationalCell)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:asOrganizationPartOf[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/hl7:wholeOrganization[hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']]"
         id="d16e2382-false-d14051e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.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'] appears too often [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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/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 fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:asOrganizationPartOf[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.3.2']/hl7:asOrganizationPartOf[not(@nullFlavor)][hl7:wholeOrganization]/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="d16e2384-false-d14069e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.2.2.2')">(plCdaBaseOrganizationalCell): The value for root SHALL be '2.16.840.1.113883.3.4424.2.2.2'. Found: "<value-of select="@root"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalCell): attribute @extension SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalCell): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</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[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']
Item: (plCdaBaseOrganizationalCell)
-->

   <rule fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:asOrganizationPartOf[not(@nullFlavor)]/hl7:wholeOrganization[hl7:id/@root='2.16.840.1.113883.3.4424.2.2.2']"
         id="d16e2394-false-d14084e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="count(hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2']) &gt;= 1">(plCdaBaseOrganizationalCell): element hl7:id[@root = '2.16.840.1.113883.3.4424.2.2.2'] is mandatory [min 1x].</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.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'] appears too often [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[not(@nullFlavor)]/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 fpi="RULC-1"
         context="*[hl7:templateId[@root = '2.16.840.1.113883.3.4424.13.10.2.18']]/hl7:asOrganizationPartOf[not(@nullFlavor)]/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="d16e2396-false-d14102e0">
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="string(@root) = ('2.16.840.1.113883.3.4424.2.2.2')">(plCdaBaseOrganizationalCell): The value for root SHALL be '2.16.840.1.113883.3.4424.2.2.2'. Found: "<value-of select="@root"/>"</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="@extension">(plCdaBaseOrganizationalCell): attribute @extension SHALL be present.</assert>
      <assert role="error"
              see="https://www.csioz.gov.pl/HL7POL/pl-cda-html-pl-PL/plcda-html-develop/tmp-2.16.840.1.113883.3.4424.13.10.2.18-2018-06-30T000000.html"
              test="not(@extension) or string-length(@extension)&gt;0">(plCdaBaseOrganizationalCell): Attribute @extension SHALL be of data type 'st'  - '<value-of select="@extension"/>'</assert>
   </rule>
</pattern>
