Skip to main content

 Tutorials

Task-driven tutorials and recipes for PageSeeder

How to create a properties fragment

Skills required:XML
Time required (minutes):15
Intended audience:Developer
Difficulty:Easy
Category:Document

Objective

PSML supports a special class of fragments known as properties fragments. These name/value pairs can be used to store information such as metadata. This tutorial will explain how they can be implemented.

Tutorial

Introduction

By default, sections in PageSeeder documents use the PSML format, however editing other formats and structures are also supported through built-in editors.

Because it is not possible to change the default document type, this exercise requires the use of a custom document.

To insert a new section into an existing document, export the document and use a text or XML editor to insert the new section in the PSML file.

Create a new document type

This step can be skipped if the documents to be changed already belong to a custom document type.

Otherwise, follow the tutorial How to create a new document type.

Create a new section with <properties-fragment>

Edit the document-template.psml file for the specific document type from the Template configuration administration page. For example 'movie_information' created in the previous tutorial above.

Template configuration page – Edit template

Insert a new <section> element containing a <properties-fragment> element as shown below:

<document type="movie_information" level="portable"
          xmlns:t="http://pageseeder.com/psml/template">

  <section id="title">
    <fragment id="1">
      <heading level="1"><t:value name="ps.title"/></heading>
    </fragment>
  </section>
 
  <section id="details">
    <properties-fragment id="3">
      <property name="directed_by" title="Directed by"/>
      <property name="film_genre" title="Film genre" multiple="true"/>
      <property name="classification" title="Classification"/>
      <property name="opening_date" title="Opening date" datatype="date"/>
      <property name="related_films" title="Related films" datatype="xref"/>
    </properties-fragment>
  </section>

</document>

Configure the editor

Where properties are a big component of the data, customizing the editor can improve productivity or data quality. To learn more about this topic, see the How to configure a custom properties editor tutorial or the PSML properties editor reference documentation.

Created on , last edited on

Available tutorials