<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:xs="http://www.w3.org/2001/XMLSchema"
                xmlns:sch="http://www.ascc.net/xml/schematron"
                xmlns:iso="http://purl.oclc.org/dsdl/schematron"
                xmlns:item="http://www.escidoc.de/schemas/item/0.3"
                xmlns:escidocMetadataRecords="http://www.escidoc.de/schemas/metadatarecords/0.3"
                xmlns:dc="http://purl.org/dc/elements/1.1/"
                xmlns:dcterms="http://purl.org/dc/terms/"
                xmlns:escidocMetadataProfile="http://escidoc.mpg.de/metadataprofile/schema/0.1/"
                xmlns:escidoc="http://escidoc.mpg.de/metadataprofile/schema/0.1/types"
                xmlns:escidocComponents="http://www.escidoc.de/schemas/item/0.3/components"
                xmlns:publication="http://escidoc.mpg.de/metadataprofile/schema/0.1/publication"
                xmlns:xlink="http://www.w3.org/1999/xlink"
                version="2.0"><!--Implementers: please note that overriding process-prolog or process-root is 
    the preferred method for meta-stylesheets to use where possible. The name or details of 
    this mode may change during 1Q 2007.-->


<!--PHASES-->


<!--PROLOG-->


<!--KEYS-->


<!--DEFAULT RULES-->


<!--MODE: SCHEMATRON-FULL-PATH-->
<!--This mode can be used to generate an ugly though full XPath for locators-->
<xsl:template match="*" mode="schematron-get-full-path">
      <xsl:apply-templates select="parent::*" mode="schematron-get-full-path"/>
      <xsl:text>/</xsl:text>
      <xsl:choose>
         <xsl:when test="namespace-uri()=''">
            <xsl:value-of select="name()"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:text>*:</xsl:text>
            <xsl:value-of select="local-name()"/>
            <xsl:text>[namespace-uri()='</xsl:text>
            <xsl:value-of select="namespace-uri()"/>
            <xsl:text>']</xsl:text>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:variable name="preceding"
                    select="count(preceding-sibling::*[local-name()=local-name(current())and namespace-uri() = namespace-uri(current())])"/>
      <xsl:text>[</xsl:text>
      <xsl:value-of select="1+ $preceding"/>
      <xsl:text>]</xsl:text>
   </xsl:template>
   <xsl:template match="@*" mode="schematron-get-full-path">
      <xsl:apply-templates select="parent::*" mode="schematron-get-full-path"/>
      <xsl:text>/</xsl:text>
      <xsl:choose>
         <xsl:when test="namespace-uri()=''">@iso:schema</xsl:when>
         <xsl:otherwise>
            <xsl:text>@*[local-name()='</xsl:text>
            <xsl:value-of select="local-name()"/>
            <xsl:text>' and namespace-uri()='</xsl:text>
            <xsl:value-of select="namespace-uri()"/>
            <xsl:text>']</xsl:text>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--MODE: SCHEMATRON-FULL-PATH-2-->
<!--This mode can be used to generate prefixed XPath for humans-->
<xsl:template match="node() | @*" mode="schematron-get-full-path-2">
      <xsl:for-each select="ancestor-or-self::*">
         <xsl:text>/</xsl:text>
         <xsl:value-of select="name(.)"/>
         <xsl:if test="preceding-sibling::*[name(.)=name(current())]">
            <xsl:text>[</xsl:text>
            <xsl:value-of/>
            <xsl:text>]</xsl:text>
         </xsl:if>
      </xsl:for-each>
      <xsl:if test="not(self::*)">
         <xsl:text/>/@<xsl:value-of select="name(.)"/>
      </xsl:if>
   </xsl:template>

   <!--MODE: GENERATE-ID-FROM-PATH -->
<xsl:template match="/" mode="generate-id-from-path"/>
   <xsl:template match="text()" mode="generate-id-from-path">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:value-of select="concat('.text-', 1+count(preceding-sibling::text()), '-')"/>
   </xsl:template>
   <xsl:template match="comment()" mode="generate-id-from-path">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:value-of select="concat('.comment-', 1+count(preceding-sibling::comment()), '-')"/>
   </xsl:template>
   <xsl:template match="processing-instruction()" mode="generate-id-from-path">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:value-of select="concat('.processing-instruction-', 1+count(preceding-sibling::processing-instruction()), '-')"/>
   </xsl:template>
   <xsl:template match="@*" mode="generate-id-from-path">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:value-of select="concat('.@', name())"/>
   </xsl:template>
   <xsl:template match="*" mode="generate-id-from-path" priority="-0.5">
      <xsl:apply-templates select="parent::*" mode="generate-id-from-path"/>
      <xsl:text>.</xsl:text>
      <xsl:choose>
         <xsl:when test="count(. | ../namespace::*) = count(../namespace::*)">
            <xsl:value-of select="concat('.namespace::-',1+count(namespace::*),'-')"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:value-of select="concat('.',name(),'-',1+count(preceding-sibling::*[name()=name(current())]),'-')"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--MODE: GENERATE-ID-2 -->
<xsl:template match="/" mode="generate-id-2">U</xsl:template>
   <xsl:template match="*" mode="generate-id-2" priority="2">
      <xsl:text>U</xsl:text>
      <xsl:number level="multiple" count="*"/>
   </xsl:template>
   <xsl:template match="node()" mode="generate-id-2">
      <xsl:text>U.</xsl:text>
      <xsl:number level="multiple" count="*"/>
      <xsl:text>n</xsl:text>
      <xsl:number count="node()"/>
   </xsl:template>
   <xsl:template match="@*" mode="generate-id-2">
      <xsl:text>U.</xsl:text>
      <xsl:number level="multiple" count="*"/>
      <xsl:text>_</xsl:text>
      <xsl:value-of select="string-length(local-name(.))"/>
      <xsl:text>_</xsl:text>
      <xsl:value-of select="translate(name(),':','.')"/>
   </xsl:template>
   <!--Strip characters--><xsl:template match="text()" priority="-1"/>

   <!--SCHEMA METADATA-->
<xsl:template match="/">
      <validation-report phase="accept_item">

         <pattern>event_title_required</pattern>
         <xsl:apply-templates select="/" mode="M12"/>
         <pattern>source_title_required</pattern>
         <xsl:apply-templates select="/" mode="M13"/>
         <pattern>creator_role_required</pattern>
         <xsl:apply-templates select="/" mode="M14"/>
         <pattern>correct_date_format</pattern>
         <xsl:apply-templates select="/" mode="M15"/>
         <pattern>component_data_required</pattern>
         <xsl:apply-templates select="/" mode="M16"/>
         <pattern>component_data_required</pattern>
         <xsl:apply-templates select="/" mode="M17"/>
         <pattern>component_data_required</pattern>
         <xsl:apply-templates select="/" mode="M18"/>
         <pattern>component_data_required</pattern>
         <xsl:apply-templates select="/" mode="M19"/>
         <pattern>title_required</pattern>
         <xsl:apply-templates select="/" mode="M20"/>
         <pattern>genre_required</pattern>
         <xsl:apply-templates select="/" mode="M21"/>
         <pattern>creator_required</pattern>
         <xsl:apply-templates select="/" mode="M23"/>
         <pattern>publisher_name_required</pattern>
         <xsl:apply-templates select="/" mode="M24"/>
         <pattern>organization_name_required</pattern>
         <xsl:apply-templates select="/" mode="M25"/>
         <pattern>date_required</pattern>
         <xsl:apply-templates select="/" mode="M26"/>
         <pattern>source_required</pattern>
         <xsl:apply-templates select="/" mode="M27"/>
         <pattern>review_method_required</pattern>
         <xsl:apply-templates select="/" mode="M28"/>
      </validation-report>
   </xsl:template>

   <!--SCHEMATRON PATTERNS-->


<!--PATTERN event_title_required-->


	<!--RULE -->
<xsl:template match="event:event" priority="4000" mode="M12">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="dc:title != '' or not(* != '' or @xml:lang != '')"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>EventTitleNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M12"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M12"/>
   <xsl:template match="@*|node()" priority="-2" mode="M12">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M12"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M12"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN source_title_required-->


	<!--RULE -->
<xsl:template match="source:source" priority="4000" mode="M13">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="dc:title != '' or not(normalize-space(.) != '' or .//*/@* != '')"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>SourceTitleNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M13"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M13"/>
   <xsl:template match="@*|node()" priority="-2" mode="M13">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M13"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M13"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN creator_role_required-->


	<!--RULE -->
<xsl:template match="source:source" priority="4000" mode="M14">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="escidoc:creator/@role != '' or not(normalize-space(escidoc:creator) != '' or escidoc:creator//*/@* != '')"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>SourceCreatorRoleNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M14"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M14"/>
   <xsl:template match="@*|node()" priority="-2" mode="M14">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M14"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M14"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN correct_date_format-->


	<!--RULE -->
<xsl:template match="dcterms:created|dcterms:modified|dcterms:issued|dcterms:dateAccepted|dcterms:dateSubmitted"
                 priority="4000"
                 mode="M15">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test=". = '' or (matches(., '^\\d\\d\\d\\d(-\\d\\d){0,2}$') and substring(concat(., '-01-01'), 1, 10) castable as xs:date)"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>DateFormatIncorrect</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M15"/>
   </xsl:template>

	  <!--RULE -->
<xsl:template match="escidoc:start-date" priority="3999" mode="M15">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test=". = '' or (matches(., '^\\d\\d\\d\\d(-\\d\\d){0,2}$') and substring(concat(., '-01-01'), 1, 10) castable as xs:date)"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>DateFormatIncorrect</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M15"/>
   </xsl:template>

	  <!--RULE -->
<xsl:template match="escidoc:end-date" priority="3998" mode="M15">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test=". = '' or (matches(., '^\\d\\d\\d\\d(-\\d\\d){0,2}$') and substring(concat(., '-01-01'), 1, 10) castable as xs:date)"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>DateFormatIncorrect</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>

		    <!--ASSERT -->
<xsl:choose>
         <xsl:when test=". = '' or ../escidoc:start-date != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>EndDateWithoutStartDate</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M15"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M15"/>
   <xsl:template match="@*|node()" priority="-2" mode="M15">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M15"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M15"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN component_data_required-->


	<!--RULE -->
<xsl:template match="escidocComponents:component" priority="4000" mode="M16">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="not(escidocComponents:content/@xlink:href != '') or escidocComponents:properties/escidocComponents:file-name != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>ComponentFileNameNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M16"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M16"/>
   <xsl:template match="@*|node()" priority="-2" mode="M16">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M16"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M16"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN component_data_required-->


	<!--RULE -->
<xsl:template match="escidocComponents:component" priority="4000" mode="M17">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="not(escidocComponents:content/@xlink:href != '') or escidocComponents:properties/escidocComponents:content-category != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>ComponentContentCategoryNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M17"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M17"/>
   <xsl:template match="@*|node()" priority="-2" mode="M17">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M17"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M17"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN component_data_required-->


	<!--RULE -->
<xsl:template match="escidocComponents:component" priority="4000" mode="M18">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="not(escidocComponents:content/@xlink:href != '') or escidocComponents:properties/escidocComponents:mime-type != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>ComponentMimeTypeNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M18"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M18"/>
   <xsl:template match="@*|node()" priority="-2" mode="M18">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M18"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M18"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN component_data_required-->


	<!--RULE -->
<xsl:template match="escidocComponents:component" priority="4000" mode="M19">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="not(escidocComponents:content/@xlink:href != '') or escidocComponents:properties/escidocComponents:visibility != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>ComponentVisibilityNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M19"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M19"/>
   <xsl:template match="@*|node()" priority="-2" mode="M19">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M19"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M19"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN title_required-->


	<!--RULE -->
<xsl:template match="publication:publication" priority="4000" mode="M20">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="dc:title != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>TitleNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M20"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M20"/>
   <xsl:template match="@*|node()" priority="-2" mode="M20">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M20"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M20"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN genre_required-->


	<!--RULE -->
<xsl:template match="publication:publication" priority="4000" mode="M21">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="@type != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>GenreNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M21"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M21"/>
   <xsl:template match="@*|node()" priority="-2" mode="M21">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M21"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M21"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN creator_required-->


	<!--RULE -->
<xsl:template match="publication:publication" priority="4000" mode="M23">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="escidoc:creator/person:person/escidoc:family-name != '' or escidoc:creator/organization:organization/dc:title != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>CreatorNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>

		    <!--ASSERT -->
<xsl:choose>
         <xsl:when test="escidoc:creator/@role != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>CreatorRoleNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>

		    <!--ASSERT -->
<xsl:choose>
         <xsl:when test="escidoc:creator/person:person/organization:organization/dc:title != '' or escidoc:creator/organization:organization/dc:title != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>OrganizationalMetadataNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M23"/>
   </xsl:template>

	  <!--RULE -->
<xsl:template match="publication:publication/escidoc:creator/person:person"
                 priority="3999"
                 mode="M23">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="escidoc:family-name != ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>CreatorFamilyNameNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M23"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M23"/>
   <xsl:template match="@*|node()" priority="-2" mode="M23">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M23"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M23"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN publisher_name_required-->


	<!--RULE -->
<xsl:template match="escidoc:publishing-info" priority="4000" mode="M24">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="dc:publisher != '' or not(* != '')"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>PublisherNameNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M24"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M24"/>
   <xsl:template match="@*|node()" priority="-2" mode="M24">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M24"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M24"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN organization_name_required-->


	<!--RULE -->
<xsl:template match="organization:organization" priority="4000" mode="M25">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="dc:title != '' or not(escidoc:address) or escidoc:address = ''"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>OrganizationNameNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M25"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M25"/>
   <xsl:template match="@*|node()" priority="-2" mode="M25">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M25"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M25"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN date_required-->


	<!--RULE -->
<xsl:template match="publication:publication" priority="4000" mode="M26">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="(@type = 'series' or @type = 'journal' or @type = 'manuscript' or @type = 'other') or ((dcterms:created != '') or (dcterms:modified != '') or (dcterms:dateSubmitted != '') or (dcterms:dateAccepted != '') or (dcterms:issued != ''))"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>DateNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M26"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M26"/>
   <xsl:template match="@*|node()" priority="-2" mode="M26">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M26"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M26"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN source_required-->


	<!--RULE -->
<xsl:template match="publication:publication" priority="4000" mode="M27">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="not(@type = 'article' or @type = 'book-item' or @type = 'conference-paper') or (source:source/dc:title != '')"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>SourceNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M27"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M27"/>
   <xsl:template match="@*|node()" priority="-2" mode="M27">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M27"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M27"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>

   <!--PATTERN review_method_required-->


	<!--RULE -->
<xsl:template match="publication:publication" priority="4000" mode="M28">

		<!--ASSERT -->
<xsl:choose>
         <xsl:when test="not(dcterms:issued != '') or (publication:review-method != '')"/>
         <xsl:otherwise>
            <failure infolevel="restrictive">
               <message>
                  <name>ReviewMethodNotProvided</name>
                  <path>
                     <xsl:apply-templates mode="schematron-get-full-path" select="."/>
                  </path>
                  <element>
                     <xsl:value-of select="name()"/>
                  </element>
               </message>
               <diagnostics/>
            </failure>
         </xsl:otherwise>
      </xsl:choose>
      <xsl:apply-templates select="@*|*|comment()|processing-instruction()" mode="M28"/>
   </xsl:template>
   <xsl:template match="text()" priority="-1" mode="M28"/>
   <xsl:template match="@*|node()" priority="-2" mode="M28">
      <xsl:choose><!--Housekeeping: SAXON warns if attempting to find the attribute
                           of an attribute--><xsl:when test="not(@*)">
            <xsl:apply-templates select="node()" mode="M28"/>
         </xsl:when>
         <xsl:otherwise>
            <xsl:apply-templates select="@*|node()" mode="M28"/>
         </xsl:otherwise>
      </xsl:choose>
   </xsl:template>
</xsl:stylesheet>