Guide

The end-user manual for PageSeeder

 

PSML Schematron

The default.sch schematron file is used to validate and report on PSML documents.

Example

<?xml version="1.0"?>
<!--
  This schematron validates a PSML document.

  The schematron rules can be used to enforce additional constraints required
  by the application.

  @see https://dev.pageseeder.com/api/data/psml.html
-->
<sch:schema xmlns:sch="http://purl.oclc.org/dsdl/schematron"
            title="Rules for [config] documents">

  <!--
    Set of rules applying to the entire document
  -->
  <sch:pattern name="Document">

    <sch:rule context="/document">

      <!-- Too many sections -->
      <sch:assert test="count(section) le 20">Your document contains over 20
      sections. You should consider splitting your document into multiple
      documents.</sch:assert>

      <!-- No Doc ID -->
      <sch:report test="not(documentinfo/uri/@docid)">Your document
      does not have a Doc ID.</sch:report>

      <!-- No Label -->
      <sch:report test="not(documentinfo/uri/@labels)">Your document
      has no label.</sch:report>

    </sch:rule>

  </sch:pattern>

  <!--
    Set of rules applying to the document sections
  -->
  <sch:pattern name="Sections">

    <sch:rule context="section/fragment">

      <!-- Section has no heading -->
      <sch:assert test="name(*[1]) = 'heading'">Fragment
      '<sch:value-of select="@id"/>' has no title.</sch:assert>

      <!-- Section is too long (over 2000 chars)-->
      <sch:assert test="string-length(string-join(.//text(), '')) le 2000">
      Fragment '<sch:value-of select="@id"/>' has over 2000 characters.
      </sch:assert>

    </sch:rule>

  </sch:pattern>

</sch:schema>

Created on , last edited on