XProc at the of an ebookproduction framework


Romain Deltour

XML Prague – February 9th 2013

The DAISY Consortium envisions a world where people with print disabilities have equal access to information and knowledge, without delay or additional expense.
DAISY Consortium logo  http://daisy.org 

Single-source publishing

Convert from a single XML master document to a variety of output formats However a variety of different input XML formats can be used.

A modular XML system

A complex sytem of pipes
Maintain these pipelines ? ...sigh...
Lego bricks in a Lego truck
Modules to the rescue!

Modules

A module, concretely

META-INF/catalog.xml
<catalog
  xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
  <uri name="http://www.daisy.org/mod/daisy3-to-epub3"
       uri="../xml/xproc/daisy3-to-epub3.xpl"/>
</catalog>
META-INF/MANIFEST.MF

Bundle-SymbolicName: org.daisy.pipeline.modules.daisy3-to-epub3
Bundle-Version: 1.0.0.SNAPSHOT
Require-Bundle: org.daisy.pipeline.modules.epub3-nav-utils,...

A shared URI resolver registers the modules' catalogs

Beyond XProc...

a complex system of pipes
A complex system, we know, but...
water taps
a simple user interface!

Users should only be aware of top-level scripts

Adding user-friendly metadata

XProc
<p:documentation 
    xmlns="http://www.w3.org/1999/xhtml">
  <h1 px:role="name">DAISY 3 to EPUB 3</h1>
  <p px:role="desc">Transforms a DAISY 3 publication
     into an EPUB 3 publication.</p>
  <p px:role="author maintainer">Romain Deltour</p>
  <p>See the <a href="..." px:role="homepage">
      online documentation</a>
  </p>
</p:documentation>

Typing the XProc signature

XProc
<p:input port="source" px:media-type="text/xml"
         primary="true" sequence="false">
    ...
</p:input>
<p:option name="mediaoverlay" px:type="boolean"
          required="false" select="'true'" >
    ...
</p:option>

Hiding idiosyncrasies

Pipeline A
<p:declare-step>
  <p:input port="source"/>
  <p:output port="result" sequence="false"/>
      ...
</p:declare-step>
Pipeline B
<p:declare-step>
  <p:input port="source"/>
  <p:option name="result-uri" required="true"
            px:output="result"/>
      ...
  <p:store>
    <p:with-option name="href" select="$result-uri"/>
  </p:store>
</p:declare-step>

Summary

XProc Tips & Best practices

Use intermediary formats
(e.g. for fileset manipulations)

A fileset format

Fileset
<d:fileset
      xmlns:d="http://www.daisy.org/ns/pipeline/data"
      xml:base="file:///Users/me">
  <d:file href="mimetype"/>
  <d:file href="META-INF/container.xml"/>
  <d:file href="Content/package.opf"
          media-type="application/oebps-package+xml" />
  <d:file href="Content/toc.ncx"
          media-type="application/x-dtbncx+xml"/>
  <d:file href="http://www.example.org/style.css"
          media-type="text/css"/>
</d:fileset>

Rely on base URIs

Use XProc for orchestration

Summary

A wishlist

Join the community!

Thank You!