Skip to main content

 Element reference

PSML elements from <author> to <xref>



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

Other fragment elements are the following:

Usage context

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


This element includes the following attributes:

idfragment-idyesThe fragment ID
mediatypexs:stringyesA media 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 must 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 , 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"


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 might cause your document to display incorrectly or to be handled incorrectly during publishing.

Media types which are known to work are the following:

  • text/plain
  • application/mathml+xml
  • image/svg+xml
  • application/xml
Created on , last edited on