<?xml version="1.0" encoding="UTF-8"?>
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron" queryBinding="xslt2">
  <sch:ns prefix="f" uri="http://hl7.org/fhir"/>
  <sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
  <!-- 
    This file contains just the constraints for the profile Location
    It includes the base constraints for the resource as well.
    Because of the way that schematrons and containment work, 
    you may need to use this schematron fragment to build a, 
    single schematron that validates contained resources (if you have any) 
  -->
  <sch:pattern>
    <sch:title>f:Location</sch:title>
    <sch:rule context="f:Location">
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-Location.availabilityExceptions|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-Location.availabilityExceptions|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:Location/f:hoursOfOperation</sch:title>
    <sch:rule context="f:Location/f:hoursOfOperation">
      <sch:assert test="count(f:id) &lt;= 1">id: maximum cardinality of 'id' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-Location.hoursOfOperation.allDay|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-Location.hoursOfOperation.allDay|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-Location.hoursOfOperation.openingTime|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-Location.hoursOfOperation.openingTime|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
      <sch:assert test="count(f:extension[@url = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-Location.hoursOfOperation.closingTime|0.1.0']) &lt;= 1">extension with URL = 'http://hl7.org/fhir/4.0/StructureDefinition/extension-Location.hoursOfOperation.closingTime|0.1.0': maximum cardinality of 'extension' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:Location/f:hoursOfOperation/f:availableTime</sch:title>
    <sch:rule context="f:Location/f:hoursOfOperation/f:availableTime">
      <sch:assert test="count(f:id) &lt;= 1">id: maximum cardinality of 'id' is 1</sch:assert>
      <sch:assert test="count(f:allDay) &lt;= 1">allDay: maximum cardinality of 'allDay' is 1</sch:assert>
      <sch:assert test="count(f:availableStartTime) &lt;= 1">availableStartTime: maximum cardinality of 'availableStartTime' is 1</sch:assert>
      <sch:assert test="count(f:availableEndTime) &lt;= 1">availableEndTime: maximum cardinality of 'availableEndTime' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
  <sch:pattern>
    <sch:title>f:Location/f:hoursOfOperation/f:notAvailableTime</sch:title>
    <sch:rule context="f:Location/f:hoursOfOperation/f:notAvailableTime">
      <sch:assert test="count(f:id) &lt;= 1">id: maximum cardinality of 'id' is 1</sch:assert>
      <sch:assert test="count(f:description) &lt;= 1">description: maximum cardinality of 'description' is 1</sch:assert>
      <sch:assert test="count(f:during) &lt;= 1">during: maximum cardinality of 'during' is 1</sch:assert>
    </sch:rule>
  </sch:pattern>
</sch:schema>
