Skip to main content

 Sample Code

Some code samples

PSML sample code

Following are some PSML code samples that can be used as templates.

Basic PSML document


A basic document with placeholders for content:

<?xml version="1.0" encoding="UTF-8"?>
<document level="portable" [type="[your document type]"]>
  <section id="title">
    <fragment id="1">
      <heading level="1">[your document title]</heading>
  <section id="content">
    <fragment id="2">
      <para>[your first paragraph]</para>
      <!-- more PSML content here... -->

Basic table


A basic table structure with header row.

  <col width="200px"/>
  <col width="100px"/>
  <row part="header">
    <cell>Alice's Adventures in Wonderland</cell>
    <cell>Lewis Carol</cell>
    <cell>Gulliver's Travels</cell>
    <cell>Jonathan Swift</cell>

Properties fragment


A specialized structure, the <properties-fragment> is suited to the capture, editing and validation of name/value pairs.

<section id="metadata">
  <properties-fragment id="4" >
    <property name="title" title="Book Title"
              value="Alice's Adventures in Wonderland"/>
    <property name="isbn" title="ISBN"
    <property name="author" title="Author"
              value="Lewis Caroll"/>
    <property name="language" title="Language" multiple="true">
    <property name="country" title="Country"
    <property name="available-date" datatype="date"
              title="Available date"
    <property name="related" datatype="xref" title="Related"
      <xref href="book4.psml" frag="default"/>
      <xref href="book7.psml" frag="default"/>

Cross-reference fragment


An editing interface specialized for cross-references. Users find this interface very productive for creating, editing and ordering links. 

<section id="links">
  <xref-fragment id="5">
    <blockxref href="chapter1.psml"
               frag="default">Chapter 1: Down the Rabbit-Hole</blockxref>
    <blockxref href="chapter2.psml"
               frag="default">Chapter 2: The Pool of Tears</blockxref>

Fragment template

Adding this to the document-template allows users to add a specific fragment type using the standard editing environment.

<t:fragment type="parameter" title="Parameter">
    <properties-fragment id="4">
      <property name="field"     title="Field"       value=""/>
      <property name="type"      title="Type"        value=""/>
      <property name="mandatory" title="Mandatory"   value=""/>
      <property name="desc"      title="Description" value=""/>



When coding the creation of <xref> or <blockxref> elements, it is useful to remember that the server automatically expands minimally-expressed links. This allows developers to only code for the key location and title data:

<xref href="filename.psml"
      frag="default">the title to be displayed</xref>

<xref docid="server-wide_uniqueid" 
      frag="default">the title to be displayed</xref>
<xref uriid="9999"
      frag="5">the title to be displayed</xref>

Except for an <xref> or <blockxref> using the uriid attribute, which is generated by the system, xrefs can be created even if the other end of the link does not exist. Or the collection of linked documents is only partially complete.

To process the links, any user with the appropriate rights can go to the Administration menu, Group maintenance page, and select the option to Resolve.... PageSeeder then resolves the <xref>, <link>, and <image> elements, adds the implied attributes and values and creates a <reversexref> element in the destination document.

Created on , last edited on