Skip to main content

 Advanced

Advanced topics

PSML split config schema reference

Version: 0.5.0

This schema defines rules for splitting a single PSML file into multiple containers, documents and fragments. A container is a references document or similar containing XRefs to component documents that make up a publication.

Examples

A simple example with a single main container, a new document for each heading level 1 or 2 and a new fragment for each heading level 3 or 4:

<split-config  version="0.5.0">
    <container />
    <document folder="components">
        <heading level="1"/>
        <heading level="2"/>
    </document>
    <fragment>
        <heading level="3"/>
        <heading level="4"/>
    </fragment>
</split-config>

A more complex example with multiple containers, folders, document types and labels:

<split-config>
    <container type="contract"
               labels="contract" />
    <container type="schedules"
               labels="schedule"
               contains="schedule" />
    <container type="definitions"
               labels="clause"
               contains="term"
               folder="clauses">
        <start>
            <block label="def-start" />
        </start>
        <continue>
            <block label="def-end" />
        </continue>
    </container>

    <document type="clause"
              labels="clause"
              folder="clauses" >
        <heading level="1"/>
    </document>
    <document type="schedule"
              labels="schedule"
              folder="schedules">
        <block label="schedule"/>
    </document>
    <document type="term"
              labels="term"
              folder="terms">
        <block label="definition" />
    </document>

    <fragment>
        <heading level="2"/>
        <heading level="3"/>
        <para numbered="true"/>
    </fragment>
</split-config>

Schema header

<xs:schema  elementFormDefault="unqualified"  
            version="0.5.0"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            xmlns:xml="http://www.w3.org/XML/1998/namespace" />

<split-config>

This is the root element and must contain at least one empty <container> element (i.e. that has no child elements). The first of these empty <container> elements defines the main container (aka the publication root).

version The version of the schema for this config file (optional).

<xs:element  name="split-config">
    <xs:complexType>
      <xs:sequence>
        <xs:element  ref="container"  minOccurs="1"  maxOccurs="unbounded" />
        <xs:element  ref="document"  minOccurs="0"  maxOccurs="unbounded" />
        <xs:element  ref="fragment"  minOccurs="0"  maxOccurs="unbounded" />
      </xs:sequence>
      <xs:attribute  name="version"  type="xs:string" />
    </xs:complexType>
  </xs:element>

<container>

Defines when to create a new container. A container is a references document or similar containing XRefs to component documents that make up the publication. All attributes are optional.

type The document type of the container -default references (optional).

folder The name of the folder to put the container document in (optional).

labels A comma-separated list of document labels for the container (optional).

contains A document type that this container should reference (optional).

<xs:element  name="container">
    <xs:complexType>
      <xs:sequence>
        <xs:element  ref="start"  minOccurs="0"  maxOccurs="1" />
        <xs:element  ref="continue"  minOccurs="0"  maxOccurs="1" />
      </xs:sequence>
      <xs:attribute  name="type"  type="document-type" />
      <xs:attribute  name="folder"  type="xs:string" />
      <xs:attribute  name="labels"  type="label-list" />
      <xs:attribute  name="contains"  type="xs:string" />
    </xs:complexType>
  </xs:element>

<start>

If a container should have other content before it's list of XRefs this element defines where this content starts.

<xs:element  name="start">
    <xs:complexType>
      <xs:choice  minOccurs="0"  maxOccurs="unbounded">
        <xs:element  ref="heading" />
        <xs:element  ref="block" />
      </xs:choice>
    </xs:complexType>
  </xs:element>

<continue>

If a container should have other content after it's list of XRefs this element defines where this content starts.

<xs:element  name="continue">
    <xs:complexType>
      <xs:choice  minOccurs="0"  maxOccurs="unbounded">
        <xs:element  ref="heading" />
        <xs:element  ref="block" />
      </xs:choice>
    </xs:complexType>
  </xs:element>

<document>

Defines when to create a new document.

type The document type (optional).

folder The name of the folder to put the document in (optional).

labels A comma-separated list of document labels for the document (optional).

<xs:element  name="document">
    <xs:complexType>
      <xs:choice  minOccurs="0"  maxOccurs="unbounded">
        <xs:element  ref="heading" />
        <xs:element  ref="block" />
        <xs:element  ref="inline" />
      </xs:choice>
      <xs:attribute  name="type"  type="document-type" />
      <xs:attribute  name="folder"  type="xs:string" />
      <xs:attribute  name="labels"  type="label-list" />
    </xs:complexType>
  </xs:element>

<fragment>

Defines when to create a new fragment.

type The type of the fragment if it has one (optional).

labels A comma-separated list of fragment labels for the fragment (optional).

<xs:element  name="fragment">
    <xs:complexType>
      <xs:choice  minOccurs="0"  maxOccurs="unbounded">
        <xs:element  ref="heading" />
        <xs:element  ref="block" />
        <xs:element  ref="para" />
      </xs:choice>
      <xs:attribute  name="type"  type="fragment-type" />
      <xs:attribute  name="labels"  type="label-list" />
    </xs:complexType>
  </xs:element>

<heading>

Defines a starting point for a container, document or fragment as any <heading> in the original PSML with the defined @level and @numbered. The <heading> must be a direct child or grandchild (child of a child) of <fragment>.

level The @level the heading must have (required).

numbered The @numbered the heading must have - if false the heading must not have numbered="true", if not specified then any heading is matched (optional).

<xs:element  name="heading">
    <xs:complexType>
      <xs:attribute  name="level"  use="required">        
        <xs:simpleType>
          <xs:restriction  base="xs:integer">
            <xs:pattern  value="[1-6]" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute  name="numbered"  type="xs:boolean" />
    </xs:complexType>
  </xs:element>

<block>

Defines a starting point for a container, document or fragment as any <block> in the original PSML with the defined @label. However the <block> must be a direct child of <fragment>.

label The @label the the block must have (required).

<xs:element  name="block">
    <xs:complexType>
      <xs:attribute  name="label"
                     type="label"  
                     use="required" />
    </xs:complexType>
  </xs:element>

<para>

Defines a starting point for a fragment as any <para> in the original PSML with the defined @numbered. The <para> must be a direct child or grandchild (child of a child) of <fragment>.

numbered The @numbered the para must have - if false the para must not have numbered="true", if not specified then any para is matched (optional).

<xs:element  name="para">
    <xs:complexType>
      <xs:attribute  name="numbered"  type="xs:boolean" />
    </xs:complexType>
  </xs:element>

<inline>

Defines where an XRef to a placeholder document will be created by replacing an <inline> element that matches the definition. It also defines how the title and/or filename of the new placeholder document is generated. It can contain an <inline> element corresponding to a nested <inline> element in the PSML but no further nesting is allowed.

label The @label the the inline must have (required).

as If the text content of the <inline> should be used for the placeholder document title or filename or both (allowed values are title, filename or title-filename). If filename is not defined it will be generated as [documenttype]-[n].psml (optional).

<xs:element  name="inline">
    <xs:complexType>
      <xs:sequence>        
      <!--  only one nesting is supported  -->
        <xs:element  ref="inline"  minOccurs="0"  maxOccurs="1" />
      </xs:sequence>
      <xs:attribute  name="label"  type="label"  use="required" />
      <xs:attribute  name="as">
        <xs:simpleType>
          <xs:restriction  base="xs:string">
            <xs:enumeration  value="title" />
            <xs:enumeration  value="filename" />
            <xs:enumeration  value="title-filename" />
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

Example

This example:

<document labels="field"
          type="field"
          folder="fields">
  <inline label="ps_field">
    <inline label="ps_field_name"
            as="title-filename" />
  </inline>
</document>

would replace:

<inline label="ps_field">
  <inline label="ps_field_name">Birth day</inline>
  10 June 2009
</inline>

with an XRef to a new placeholder document with title [Birth day] and filename birth_day.psml.

Created on , last edited on