<p:declare-stepxmlns:p="http://www.w3.org/ns/xproc"xmlns:px="http://www.daisy.org/ns/pipeline/xproc"px:input-filesets="daisy3"px:output-filesets="epub3"type="px:daisy3-to-epub3.script"version="1.0"name="main">
<p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h1px:role="name">DAISY 3 to EPUB 3</h1><ppx:role="desc">Transforms a DAISY 3 publication into an EPUB 3 publication.</p>
<apx:role="homepage"href="http://daisy.github.io/pipeline/Get-Help/User-Guide/Scripts/daisy3-to-epub3/">
Online documentation
</a>
<address>
Authors:
<dlpx:role="author">
<dt>Name:</dt>
<ddpx:role="name">Romain Deltour</dd>
<dt>E-mail:</dt>
<dd><apx:role="contact"href="mailto:rdeltour@gmail.com">rdeltour@gmail.com</a></dd>
<dt>Organization:</dt>
<ddpx:role="organization">DAISY Consortium</dd>
</dl>
</address>
</p:documentation>
<p:inputport="source"primary="true"sequence="false"px:media-type="application/oebps-package+xml">
<p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">OPF</h2><ppx:role="desc">The package file of the input DTB.</p>
</p:documentation>
</p:input><p:optionname="result"required="true"px:output="result"px:type="anyDirURI"px:media-type="text">
<p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">EPUB</h2><ppx:role="desc">The produced EPUB.</p>
</p:documentation>
</p:option><p:optionname="mediaoverlays"required="false"select="'true'"px:type="boolean">
<p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Include Media Overlays</h2><ppx:role="desc">Whether or not to include media overlays and associated audio files
(true or false).</p>
</p:documentation>
</p:option><p:optionname="validation"select="'off'"required="false"><p:pipeinfo><px:type>
<choicexmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0">
<value>off</value>
<a:documentationxml:lang="en">No validation</a:documentation>
<value>report</value>
<a:documentationxml:lang="en">Report validation issues</a:documentation>
<value>abort</value>
<a:documentationxml:lang="en">Abort on validation issues</a:documentation>
</choice>
</px:type></p:pipeinfo><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Validation</h2><ppx:role="desc">Whether to abort on validation issues.</p>
</p:documentation>
</p:option><p:optionxmlns:_="dtbook"name="_:chunk-size"select="'-1'"required="false"px:type="integer"><p:documentationxmlns="http://www.w3.org/1999/xhtml">
<h2px:role="name">Chunk size</h2><ppx:role="desc"xml:space="preserve">The maximum size of HTML files in kB. Specify "-1" for no maximum.
Top-level sections in the DTBook become separate HTML files in the resulting EPUB, and are further
split up if they exceed the given maximum size.</p>
</p:documentation>
</p:option>
<p:importhref="http://www.daisy.org/pipeline/modules/fileset-utils/library.xpl">
<p:documentation>
px:fileset-create
px:fileset-add-entry
</p:documentation>
</p:import>
<p:importhref="http://www.daisy.org/pipeline/modules/daisy3-utils/library.xpl">
<p:documentation>
px:daisy3-load
</p:documentation>
</p:import>
<p:importhref="http://www.daisy.org/pipeline/modules/epub-utils/library.xpl">
<p:documentation>
px:epub3-store
</p:documentation>
</p:import>
<p:importhref="convert.xpl"/>
<p:variablename="output-dir-checked"select="resolve-uri(replace($result,'(.+?)/?$','$1/'))"/>
<p:variablename="epub-file"select="concat($output-dir-checked,'result.epub')"/>
<px:fileset-create>
<p:with-optionname="base"select="resolve-uri('./',base-uri(/*))"/>
</px:fileset-create>
<px:fileset-add-entrymedia-type="application/oebps-package+xml">
<p:inputport="entry">
<p:pipestep="main"port="source"/>
</p:input>
</px:fileset-add-entry>
<px:daisy3-loadname="load"px:progress="1/10"px:message="Loading DAISY 3"/>
<px:daisy3-to-epub3name="convert"px:progress="8/10">
<p:inputport="source.in-memory">
<p:pipestep="load"port="result.in-memory"/>
</p:input>
<p:with-optionname="mediaoverlays"select="$mediaoverlays='true'"/>
<p:with-optionname="validation"select="$validation"/>
<p:with-optionxmlns:_="dtbook"name="chunk-size"select="$_:chunk-size"/>
<p:with-optionname="temp-dir"select="$temp-dir"/>
</px:daisy3-to-epub3>
<px:epub3-storepx:progress="1/10"px:message="Storing EPUB 3">
<p:with-optionname="href"select="$epub-file"/>
<p:inputport="in-memory.in">
<p:pipestep="convert"port="result.in-memory"/>
</p:input>
</px:epub3-store>
</p:declare-step>