<p:declare-stepxmlns:p="http://www.w3.org/ns/xproc"xmlns:px="http://www.daisy.org/ns/pipeline/xproc"xmlns:pxi="http://www.daisy.org/ns/pipeline/xproc/internal"xmlns:c="http://www.w3.org/ns/xproc-step"xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"version="1.0"exclude-inline-prefixes="#all"px:input-filesets="dtbook"px:output-filesets="odt"type="px:dtbook-to-odt.script"name="main">
<p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h1px:role="name">DTBook to ODT</h1><ppx:role="desc">Transforms a DTBook (DAISY 3 XML) document into an ODT (OpenDocument Text).</p>
<apx:role="homepage"href="http://daisy.github.io/pipeline/Get-Help/User-Guide/Scripts/dtbook-to-odt/">
Online documentation
</a>
<address>
Authors:
<dlpx:role="author">
<dt>Name:</dt>
<ddpx:role="name">Bert Frees</dd>
<dt>E-mail:</dt>
<dd><apx:role="contact"href="mailto:bertfrees@gmail.com">bert.frees@sbs.ch</a></dd>
<dt>Organization:</dt>
<ddpx:role="organization"href="http://www.sbs-online.ch/">SBS</dd>
</dl>
</address>
</p:documentation>
<p:inputport="source"primary="true"px:media-type="application/x-dtbook+xml">
<p:documentation>
<h2px:role="name">DTBook</h2><ppx:role="desc">The DTBook to transform.</p>
</p:documentation>
</p:input><p:optionname="result"required="true"px:output="result"px:type="anyDirURI">
<p:documentation>
<h2px:role="name">ODT</h2><ppx:role="desc">The resulting ODT file.</p>
</p:documentation>
</p:option><p:optionname="template"required="false"px:type="anyFileURI"select="''"px:media-type="application/vnd.oasis.opendocument.text-template"px:reusable="true">
<p:documentation>
<h2px:role="name">Template</h2><ppx:role="desc"xml:space="preserve">OpenOffice template file (.ott) that contains the style definitions.
Defaults to [default.ott](http://daisy.github.io/pipeline/modules/dtbook-to-odt/doc/templates/default.ott.html).
See [Templating](http://daisy.github.io/pipeline/Get-Help/User-Guide/Scripts/dtbook-to-odt/#templating) for more details.</p>
</p:documentation>
</p:option><p:optionname="asciimath"required="false"select="'ASCIIMATH'">
<p:pipeinfo>
<px:type>
<choicexmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
<value>ASCIIMATH</value>
<a:documentationxml:lang="en">Keep (as plain text)</a:documentation>
<value>MATHML</value>
<a:documentationxml:lang="en"xml:space="preserve">Convert to MathML
Convert ASCIIMath elements to MathML elements. The ASCIIMath encoding is used as the name of the
frame that contains the formula object.</a:documentation>
</choice>
</px:type>
</p:pipeinfo>
<p:documentation>
<h2px:role="name">ASCIIMath handling</h2><ppx:role="desc"xml:space="preserve">How to render ASCIIMath-encoded formulas.
Mathematical content in the DTBook may be encoded as [MathML](https://en.wikipedia.org/wiki/MathML)
elements, or as plain [ASCIIMath](https://asciimath.org/) text enclosed in `span` elements with a
"asciimath" class. MathML elements are converted to formula objects. ASCIIMath can either be treated
the same as MathML, or included as-is.</p>
</p:documentation>
</p:option><p:optionname="images"required="false"select="'EMBED'">
<p:pipeinfo>
<px:type>
<choicexmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
<value>EMBED</value>
<a:documentationxml:lang="en">Embed images in the OpenDocument package</a:documentation>
<value>LINK</value>
<a:documentationxml:lang="en">Link to external image files</a:documentation>
</choice>
</px:type>
</p:pipeinfo>
<p:documentation>
<h2px:role="name">Images handling</h2><ppx:role="desc">How to render images.</p>
</p:documentation>
</p:option><p:optionname="page-numbers"required="false"px:type="boolean"select="'true'">
<p:documentation>
<h2px:role="name">Page numbers</h2><ppx:role="desc">Whether to show page numbers or not.</p>
</p:documentation>
</p:option><p:optionname="page-numbers-float"required="false"px:type="boolean"select="'true'">
<p:documentation>
<h2px:role="name">Float page numbers</h2><ppx:role="desc">Try to float page numbers to an appropriate place as opposed to exactly following print.</p>
</p:documentation>
</p:option><p:optionname="image-dpi"required="false"px:type="integer"select="'600'">
<p:documentation>
<h2px:role="name">Image resolution</h2><ppx:role="desc">Resolution of images in DPI.</p>
</p:documentation>
</p:option>
<p:importhref="dtbook-to-odt.convert.xpl">
<p:documentation>
px:dtbook-to-odt
</p:documentation>
</p:import>
<p:importhref="http://www.daisy.org/pipeline/modules/fileset-utils/library.xpl">
<p:documentation>
px:fileset-add-entry
</p:documentation>
</p:import>
<p:importhref="http://www.daisy.org/pipeline/modules/dtbook-utils/library.xpl">
<p:documentation>
px:dtbook-load
</p:documentation>
</p:import>
<p:importhref="http://www.daisy.org/pipeline/modules/odf-utils/library.xpl">
<p:documentation>
px:odf-store
</p:documentation>
</p:import>
<p:sink/>
<px:fileset-add-entrymedia-type="application/x-dtbook+xml"name="dtbook">
<p:inputport="entry">
<p:pipestep="main"port="source"/>
</p:input>
</px:fileset-add-entry>
<px:dtbook-loadname="load">
<p:inputport="source.in-memory">
<p:pipestep="dtbook"port="result.in-memory"/>
</p:input>
</px:dtbook-load>
<px:dtbook-to-odtname="odt">
<p:inputport="content.xsl">
<p:documenthref="content.xsl"/>
</p:input>
<p:inputport="fileset.in">
<p:pipestep="load"port="result.fileset"/>
</p:input>
<p:inputport="in-memory.in">
<p:pipestep="load"port="result.in-memory"/>
</p:input>
<p:inputport="meta">
<p:inline>
<meta:generator>${project.groupId}/${project.artifactId}/${project.version}</meta:generator>
</p:inline>
<p:inline>
<meta:user-definedmeta:name="dtbook-to-odt.version">${project.version}</meta:user-defined>
</p:inline>
</p:input>
<p:with-optionname="temp-dir"select="$temp-dir"/>
<p:with-optionname="template"select="if ($template!='') then $template else resolve-uri('../templates/default.ott')">
<p:inline>
<irrelevant/>
</p:inline>
</p:with-option>
<p:with-optionname="asciimath"select="$asciimath"/>
<p:with-optionname="images"select="$images"/>
<p:with-paramport="parameters"name="image_dpi"select="$image-dpi"/>
<p:with-paramport="parameters"name="page_numbers"select="$page-numbers"/>
<p:with-paramport="parameters"name="page_numbers_float"select="$page-numbers-float"/>
</px:dtbook-to-odt>
<px:odf-storename="store">
<p:inputport="source.fileset">
<p:pipestep="odt"port="fileset.out"/>
</p:input>
<p:inputport="source.in-memory">
<p:pipestep="odt"port="in-memory.out"/>
</p:input>
<p:with-optionname="href"select="concat($result, '/', replace(p:base-uri(/),'^.*/([^/]*)\.[^/\.]*$','$1'), '.odt')">
<p:pipestep="main"port="source"/>
</p:with-option>
</px:odf-store>
</p:declare-step>