Creating the XML files

XML ( http://www.w3.org/XML/) is an acronym for "Extensible Markup Language". XML is a meta-language for describing different kinds of file formats in a standardized fashion. An XML file is an ordinary text file, but the text is formatted according to strict rules. If you have written HTML before, then you are already familiar with some of the key concepts. If you don't have any previous experience with XML, we would recommend reading an online tutorial:

The typesetting engine

The typesetting engine of Passepartout is called xml2ps and is also available as a stand-alone program. It has its own DTD [1]. XSLT stylesheets can be used to translate any XML file to the format that xml2ps will accept.

There are two basic approaches to writing text for Passepartout:

  1. Write the text in XML conforming directly to the typography-level xml2ps DTD.

  2. Write the text in XML conforming to a high level, logically stuctured DTD (either an existing one, such as XHTML or DocBook, or one of your own design), and use an XSLT stylesheet to transform the text into a document conforming to the xml2ps DTD.

The advantage with the former approach is that you get superior control over the result, while the latter method is more suitable when writing longer texts. Stylesheets for XHTML and DocBook are supplied as examples. This document is in fact formatted in DocBook itself. A good exercise for the reader is to modify the behaviour of these examples.

A description of the xml2ps DTD

Nodes allowed in an xml2ps file:

<block-container>

Root node and parent node of <para> or other <block-container> nodes.

Parameters:

margin-top, margin-bottom, margin-left, margin-right: Margins (lengths).

All <font> parameters are also accepted.

<bp>

Mark a point in a word where hyphenation is allowed.

<font>

Change font inside a <para>.

Parameters:

underline: The only accepted value is "1".

font-family: Accepted values are PostScript font (not font family) names.

font-size: Font size (a length or a percentage).

letter-spacing: Extra character spacing (a length).

<leader>

Explicit whitespace

Parameters:

width: Width of whitespace (a length).

<linebreak>

Explicit linebreak

<para>

A "paragraph". All text must be contained within paragraphs. Paragraphs may not be nested.

Parameters:

align: Text alignment. Accepted values are "left", "right", "center" and "justify".

line-height: Distance between lines as a factor relative to the font size.

All <font> and <block-container> parameters are also accepted.

Lengths may be specified in points ("12pt", "-0.3pt") or in relation to the font size ("2em", "-0.3em").

A short example


	<?xml version="1.0"?>
	<block-container font-family="Bookman-Light"
	font-size="12pt">

	<para font-family="AvantGarde-Demi" font-size="36.3pt" 
	  align="center" margin-bottom="20pt">
	This is a centered headline in Avant Garde demi-bold 36.3 points
	</para>

	<para align="justify"> This is text in
	Bookman Light 12 points.  <font
	font-size="50%">This is text in Bookman Light 6
	points.</font> Some words may be
	typeset in an <font
	font-family="Bookman-LightItalic">italic</font>
	typeface. The word
	"hyphen<bp/>ated" may be
	hyphen<bp/>ated.
	</para>

	<para margin-left="12pt" align="left"
	  line-height="1.5"> This is a left-justified
	  indented paragraph with a line height of 18 points.
	  <font underline="1">This sentence is
	  underlined.</font> In this sentence,
	  there is an unnecessary <leader
	  width="5em"/> space.
	  </para>

	</block-container>
      

Notes

[1]

Document Type Definition.