Skip to main content

 Configuration

Configuration manual for PageSeeder

PSML document template

Overview

There is either zero or one document-template.psml file per document type.

The template can specify two types of content and structure: 

  • Common – this is embedded in the template as PSML and appears in every document of that type. For example, a document-type to capture information about football players might require every document to include name, team and position.
  • optional / repeatable – this is PSML wrapped with elements from the template namespace and injected when a new document or fragment is generated. Continuing with the football player document-type, the template might provide for each player profile document to list zero, one or many previous football teams. The profile could also list other playing positions or awards the player might have been nominated for or won. For this optional and / or repeatable content in the player document-type, each document can be unique.

After development and deployment, the end user controls resolving of the optional or repeatable objects through the editing interface.

See the following links for further information on using a document type to improve productivity:

and quality:

When editing a template file in the template file panel, pressing ctrl-space provides context-sensitive, autocomplete options for the template language.

Template namespace

The field and fragment variables in http://pageseeder.com/psml/template are expressed with t: as wrappers around normal PSML content. No additional development or code is required.

To create a document-template.psml file, use the Document types tab on the Template configuration administration page.

Document-template elements

Document types don’t require a document-template. If document-template.psml is not found in:

/WEB-INF/config/template/[project]/psml/[documenttype]/

any new document for that type is generated using the settings of the default template.

/WEB-INF/config/template/default/psml/default/document-template.psml

<t:param>

The <t:param> element allows the document to be populated with values generated at the time the document is created. 

If <t:param> is a child of <document>, it appears on the Create Document dialog. If <t:param> is inside a <t:fragment> element, it appears on the Add Fragment dialog. It can have the following attributes:

AttributeDescription
nameThe parameter name (required)
title

The title displayed in the user interface (optional).

If not specified, then the parameter is NOT displayed in the user interface unless it is configured under PSMLCreation in the PSML editor config.

defaultThe default value (optional). Not supported for type xml .
type

The data type - text|integer|date|xml - default is text (optional).

If the value does not match the data type, then the default is used.

description

Information about the parameter to help users (optional). Requires PageSeeder 5.99 or higher.

When creating new documents, PageSeeder also creates the following parameters:

NameDescription
ps.titleThe title from the user interface or as specified by the <creation> options
ps.filenameThe filename of the document
ps.descriptionThe the description entered in the user interface
ps.authorThe first name and surname of the user creating the document
ps.docidThe document ID from the user interface or as specified by the <creation> options
ps.groupThe current group for the document
ps.pathThe path of the document
ps.currentdateThe current date in ISO8601 format
ps.currentdatetimeThe current datetime in ISO8601 format including timezone information
ps.currenttimeThe current time in ISO8601 format including timezone information
ps.autonumberThe autonumber generated by the document <creation> options if there is one

<t:value>

 The <t:value> element can be used to insert parameter values into the content and can appear inside any element with text content. It has the following attributes.

AttributeDescription
nameThe parameter name

Inside attributes the value can be inserted using the format {$[name]}.

<t:fragment>

The <t:fragment> element can be used to define fragment types which can be added by users editing the document. Any defined fragment type can be added inside any <section> in the document unless the section has a @fragmenttype attribute which restricts it to one fragment type. It must appear before any <section> elements and have the following attributes:

AttributeDescriptionRequired
typeThe fragment typeyes
titleThe title displayed in the user interfaceyes

It must contain one of the fragment elements: <fragment>, <properties-fragment>, <xref-fragment>, <media-fragment>.

<t:description>

If used, the <t:description> element must be the first element under <t:fragment>. It displays a description of the <t:fragment> when the mouse is over the “add fragment” option. It cannot contain any child elements.

It is recommended that every fragment type have a description.

<t:fragment-ref>

The <t:fragment-ref> element can be used to insert fragment types. It must appear inside <section> and have the following attributes:

AttributeDescription
idThe fragment id
typeThe fragment type

For further information, see fragment examples or custom documents.

@t:description

The attribute t:description can be used on <property> elements and provides information about the property to help users. Requires PageSeeder 5.99 or higher.

Example

Following is an example:

<?xml version="1.0"?>
<document xmlns:t="http://pageseeder.com/psml/template"
          level="portable">  

  <t:param name="difficulty" title="Difficulty" type="integer"
           description="1 is the easiest and 5 is the hardest"/>

  <t:fragment type="outcome" title="Outcome">
    <t:description>Adds a learning outcome</t:description>
    <fragment>
      <heading level="3">Outcome</heading>
      <para>Type description here</para>
    </fragment>
  </t:fragment>

  <t:fragment type="question" title="Question">
    <t:description>Adds a question</t:description>
    <t:param name="question-id" title="Question ID" />
    <t:param name="question-content"
             title="Content"
             default="Type content here"/>
    <fragment> 
      <para>Question ID:
        <inline label="question-id">
          <t:value name="question-id"/>
        </inline>
      </para>
      <block label="richtext">Content:
        <block label="question-content">
          <t:value name="question-content"/>
        </block>
      </block>
    </fragment>
  </t:fragment>

  <metadata>
    <properties>
      <property name="test-type"
                title="Type"
                value="" />
      <property name="test-package"
                title="Packages"
                multiple="true" />
    </properties>
  </metadata>

  <section id="title">
    <fragment id="1">
      <heading level="1">
        <t:value name="ps.title"/>
      </heading>
    </fragment>
  </section>

  <section id="details">
    <properties-fragment id="2">
      <property name="author" value="{$ps.author}"/>
      <property name="created"
                value="{$ps.currentdate}"
                datatype="date"/>
      <property name="difficulty"
                value="{$difficulty}"/>
      <property name="topics" multiple="true"
                t:description="The topics for this test"/>
    </properties-fragment>  
  </section>

  <section id="outcomes" title="Outcomes" fragmenttype="outcome">
    <t:fragment-ref id="3" type="outcome" />
  </section>

  <section id="tutorial">
    <title>Tutorial</title>
    <fragment id="4">
      <para><t:value name="ps.description"/></para>
    </fragment>
  </section>

  <section id="related">
    <title>Related</title>
    <xref-fragment id="5"/>
  </section>
</document>

Created on , last edited on