Guide

The end-user manual for PageSeeder

PSML document template

This document describes how to use the PSML document-template.psml to create a custom document. It defines the PSML markup for the document, including any fragment types that can be added by the user.

The template is the same as a document described in the PSML reference except that it also includes elements from the http://pageseeder.com/psml/template namespace which are usually identified by the t: prefix in the following structure:

<document xmlns:t="http://pageseeder.com/psml/template" level="portable">
  <t:param ... />*
  <t:fragment ... />*
  <section|toc ... />*
</document>

Details

If there is no document-template.xml defined for a document type then it will use the default template.

<t:param>

The <t:param> element can be used to define parameters which can be filled in when the document is created. If <t:param> is a child of <document> it will appear on the New Document page. If <t:param> is inside a <t:fragment> element it will appear on the Add Fragment dialog. It can have the following attributes:

AttributeDescription
nameThe parameter name
titleThe title displayed in the user interface (optional).
If not specified then the parameter will NOT be displayed in the user interface.
defaultThe default value (optional)
type

The data type - text|integer|date|datetime|xml - default is text (optional).
If the value does not match the data type then the default is used.

When creating new documents PageSeeder will also create 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

<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 should appear before any <section> elements and have the following attributes:

AttributeDescription
typeThe fragment type
titleThe title displayed in the user interface

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

<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

Example

Below 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" />

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

   <t:fragment type="question">
     <fragment>
        <t:param name="question-id" title="Question ID" />
        <t:param name="question-content" title="Content"
                            default="Type content here"/>
            <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>

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

  <section id="metadata">
    <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"   count="n"/>
    </properties-fragment>  
  </section>

  <section id="outcomes" fragmenttypes="outcome">
    <title>Learning Outcomes</title>
    <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