Step 1: Install trml2pdf and sablotron

Install trml2pdf and sablotron.

You can install it on debian or ubuntu like this:

apt-get install python-trml2pdf sablotron

Step 2: Create an XML file called "staff.xml" with the list of people

Download a example of staff.xml here.

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<badge> <name> John Doe </name> <project> University of Beijing</project> </badge>
<badge> <name> Andre Agassant </name> <project> Committee for European Foobars</project> </badge>
<badge> <name> Pieter Foo </name> <project> Black Mad</project> </badge>

Step 3: Create an XSL file called "badges.xsl"

Download a example of badges.xsl here.

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="" xmlns:fo="">
<xsl:template match="badges">
<document filename="badges.pdf">
<template pageSize="(21cm, 29.7cm)" leftMargin="1.5cm" rightMargin="1.5cm"
  topMargin="1.5cm" bottomMargin="1.2cm" title="EUPACO1 Badges" author="zoobab" allowSplitting="20">
    <pageTemplate id="all">
<!--            <image x="3.0cm" y="1.25cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/>
            <image x="13cm" y="1.25cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/>
            <image x="3.0cm" y="7.75cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/>
            <image x="13cm" y="7.75cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/>
            <image x="3.0cm" y="14.25cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/>
            <image x="13cm" y="14.25cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/>
            <image x="3.0cm" y="20.75cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/>
            <image x="13cm" y="20.75cm" width="9cm" height="1.2cm" file="pict/eupaco.png"/>
        <frame id="badge0" x1="1.7cm" y1="23.1cm" width="84mm" height="54mm"/>
        <frame id="badge9" x1="11.2cm" y1="23.1cm" width="84mm" height="54mm"/>
        <frame id="badge7" x1="1.7cm" y1="17.7cm" width="84mm" height="54mm"/>
        <frame id="badge8" x1="11.2cm" y1="17.7cm" width="84mm" height="54mm"/>
        <frame id="badge5" x1="1.7cm" y1="12.3cm" width="84mm" height="54mm"/>
        <frame id="badge6" x1="11.2cm" y1="12.3cm" width="84mm" height="54mm"/>
        <frame id="badge3" x1="1.7cm" y1="6.9cm" width="84mm" height="54mm"/>
        <frame id="badge4" x1="11.2cm" y1="6.9cm" width="84mm" height="54mm"/>
        <frame id="badge1" x1="1.7cm" y1="1.5cm" width="84mm" height="54mm"/>
        <frame id="badge2" x1="11.2cm" y1="1.5cm" width="84mm" height="54mm"/>
    <blockTableStyle id="title">
        <blockFont name="Helvetica-BoldOblique"/>
        <size size="9.5"/>
        <blockAlignment value="RIGHT" start="1,0" stop="1,0"/>
        <lineStyle kind="LINEBELOW" start="0,0" stop="1,0"/>
    <paraStyle name="name" fontName="Helvetica-Bold" fontSize="30" alignment="center" leading="27"/>
    <paraStyle name="project" fontName="Helvetica" fontSize="15" alignment="center" leading="15"/>
    <xsl:apply-templates select="badge"/>
<xsl:template match="badge">
<!--    <spacer length="0cm"/>-->
    <blockTable style="title" colWidths="4.4cm,4.4cm">
        <td>            HSF: Hacker Space Festival</td>
    <spacer length="7mm"/>
    <para style="name"><xsl:value-of select="name"/></para>
    <spacer length="0.0cm"/>
    <xsl:apply-templates select="project"/>
<xsl:template match="project">
    <spacer length="0.4cm"/>
    <para style="project"><i><xsl:value-of select="."/></i></para>

Step 4: Create badges

On the command line, type:

sabcmd badges.xsl staff.xml badges_tmp.rml
trml2pdf badges_tmp.rml > badges.pdf

You should have a file badges.pdf like this one.

Step 5: Improvements

You can also put a backgroung image, like it was done for FOSDEM badges here. See the original FOSDEM XSL file here.

TODO: put the HSF2009 background image at the right size.