A complete reference of PageSeeder's markup language PSML



The <media-fragment> element is used to include non-PSML content such as MathML, SVG or plain text.

Other fragment elements are:

Usage context

Element categorystructure
PSML levelportable
Permitted contentany
Permitted parent<section>
HTML equivalentno equivalent but similar to CDATA sections
OpenXML equivalent
PSStandard equivalent <customBody>


This element includes the following attributes

idfragment-idyesThe fragment ID.
mediatypexs:stringyesA MIME type.
typefragment-typenoA template type.
labelslabel-listnoA list of fragment labels


A fragment identifier that is unique within the document.


The media type (MIME) of the content within the media fragment. 

It should not include character encoding (charset) as the encoding is defined at the PSML document level.

Media types referring to binary documents are acceptable provided that they use an encoding that is compatible with the character encoding used at the PSML document level. In general, it is best to use base64.


If this fragment has a type or was created using a document-template.


Example #1: Plain text fragment

<media-fragment id="1" mediatype="text/plain">
  Here is some plain text content

Example #2: MathML fragment

Media fragments can be used to include MathML  in PSML document.

<media-fragment id="1" mediatype="application/mathml+xml">


PSML does not recognise MathML named entities  such as for example &InvisibleTimes;, the corresponding numeric character entity must be used instead. Beware also that some mathematical symbols do not belong to Basic Multilingual Plane (BMP). Ensure that PageSeeder is suitably configured to support Unicode characters outside the BMP. 

Example #3: SVG

Media fragments can also be used to include SVG  inside PSML.

<media-fragment id="1" mediatype="image/svg+xml">
   <svg xmlns="" version="1.1">
      <rect x="50" y="50" width="200" height="200" fill="lime" />
      <circle cx="125" cy="125" r="75" fill="orange" /> 
     <line x1="50" y1="50" x2="200" y2="200" stroke="blue" stroke-width="4"/>



XML Schema

<xs:element name="media-fragment">
    <xs:complexType mixed="true">
        <xs:any processContents="skip" minOccurs="0" maxOccurs="unbounded"/>
      <xs:attribute name="id" type="fragment-id" use="required"/>
      <xs:attribute name="type" type="fragment-type"/>
      <xs:attribute name="mediatype" type="xs:string"/>
      <xs:attribute name="labels" type="label-list"/>

Relax Schema

element media-fragment {
  attribute id { fragment-id } ,
  attribute type { fragment-type }?,
  attribute mediatype { text }?,
  attribute labels { label-list }?, 


This element was introduced in PSML Beta 4 as a replacement for the now defunct <ext-fragment> element.

It is supported from PageSeeder 5.3.


Although it is possible to define media fragments with any media type, beware that using undocumented media type may cause your document to display incorrectly or to be handled incorrectly during publishing.

Media type which are known to work:

  • text/plain
  • application/mathml+xml
  • image/svg+xml
  • application/xml

PS Standard XML

In the Standard Format, fragments that didn't contain PS Standard XML content are expressed using the <customBody> element and a different algorithm is used to compute their fragment identifier.

The PSML <media-fragment> element also supports a @mediatype attribute so that the type of content can be clearly identified in a more standard manner.

See also

Created on , last edited on