Configuration

Configuration manual for PageSeeder

PSML Schematron

Schematron enables developers to implement multiple validation regimes for any document set. For further information, see the article on Validating documents.

Note

When editing schematron files in PageSeeder pressing ctrl-space will display autocomplete options to make editing easier.

 

View schema

To view Schematron schemas, navigate to the project above the group and select the 'Schemas' menu option.dev-schematron3.JPG

Example schema

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

<?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>

Create a schema

To create a new schema requires administration rights on the server. Switch to the developer perspective and select Document types under the Dev tab. For each document type there will be an option to create a Schematron schema.

dev-doc-types.JPG

Created on , last edited on