<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" xmlns:px="http://www.daisy.org/ns/pipeline/xproc" xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:d="http://www.daisy.org/ns/pipeline/data" version="1.0" type="px:epub-to-daisy" name="main"> <p:input port="source.fileset" primary="true"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>The EPUB fileset</p> </p:documentation> </p:input> <p:input port="source.in-memory" sequence="true"/> <p:option name="tts" required="false" select="'default'"/> <p:input port="tts-config"> <p:inline><d:config/></p:inline> </p:input> <p:option name="stylesheet" select="''"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>CSS style sheets as space separated list of absolute URIs.</p> </p:documentation> </p:option> <p:option name="lexicon" cx:as="xs:anyURI*" select="()"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>PLS lexicons as list of absolute URIs.</p> </p:documentation> </p:option> <p:option name="tts-audio-file-type" select="'audio/mpeg'"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>The desired file type of the generated audio files, specified as a MIME type.</p> <p>Examples:</p> <ul> <li>"audio/mpeg"</li> <li>"audio/x-wav"</li> </ul> </p:documentation> </p:option> <p:output port="status" px:media-type="application/vnd.pipeline.status+xml" primary="true"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>Whether or not the conversion was successful.</p> </p:documentation> </p:output> <p:option name="epub3-output-dir" required="false" select="''"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>Base directory of the intermediary EPUB 3 with media-overlays</p> <p>Defaults to a temporary directory.</p> <p>The conversion may fail but will still output a EPUB 3 document.</p> </p:documentation> </p:option> <p:option name="daisy202-output-dir" required="true"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>Base directory of the DAISY 2.02</p> </p:documentation> </p:option> <p:option name="daisy3-output-dir" required="true"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>Base directory of the DAISY 3</p> </p:documentation> </p:option> <p:output port="epub3.fileset"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>The intermediary EPUB 3 fileset</p> </p:documentation> <p:pipe step="tts" port="result.fileset"/> </p:output> <p:output port="epub3.in-memory" sequence="true"> <p:pipe step="tts" port="result.in-memory"/> </p:output> <p:output port="daisy202.fileset"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>The DAISY 2.02 fileset</p> </p:documentation> <p:pipe step="daisy" port="daisy202.fileset"/> </p:output> <p:output port="daisy202.in-memory" sequence="true"> <p:pipe step="daisy" port="daisy202.in-memory"/> </p:output> <p:output port="daisy3.fileset"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>The DAISY 3 fileset</p> </p:documentation> <p:pipe step="daisy" port="daisy3.fileset"/> </p:output> <p:output port="daisy3.in-memory" sequence="true"> <p:pipe step="daisy" port="daisy3.in-memory"/> </p:output> <p:output port="temp-audio-files"> <p:documentation> List of audio files generated by the TTS step. May be deleted when the result filesets are stored. </p:documentation> <p:pipe step="tts" port="temp-audio-files"/> </p:output> <p:output port="tts-log" sequence="true"> <p:pipe step="tts" port="tts-log"/> </p:output> <p:option name="temp-dir" required="true"> <p:documentation xmlns="http://www.w3.org/1999/xhtml"> <p>Empty directory dedicated to this step. The directory will be used to store audio files.</p> </p:documentation> </p:option> <p:import href="http://www.daisy.org/pipeline/modules/common-utils/library.xpl"> <p:documentation> px:message </p:documentation> </p:import> <p:import href="http://www.daisy.org/pipeline/modules/epub2-to-epub3/library.xpl"> <p:documentation> px:epub2-to-epub3 </p:documentation> </p:import> <p:import href="http://www.daisy.org/pipeline/modules/epub3-to-epub3/library.xpl"> <p:documentation> px:epub3-to-epub3 </p:documentation> </p:import> <p:import href="http://www.daisy.org/pipeline/modules/epub3-to-daisy202/library.xpl"> <p:documentation> px:epub3-to-daisy202 </p:documentation> </p:import> <p:import href="http://www.daisy.org/pipeline/modules/epub3-to-daisy3/library.xpl"> <p:documentation> px:epub3-to-daisy3 </p:documentation> </p:import> <p:choose name="upgrade" px:progress="1/4"> <p:when test="//d:file[@media-type='application/oebps-package+xml']/@media-version='3.0'"> <p:output port="fileset" primary="true"/> <p:output port="in-memory" sequence="true"> <p:pipe step="main" port="source.in-memory"/> </p:output> <p:identity/> </p:when> <p:otherwise px:message="Upgrading to EPUB 3"> <p:output port="fileset" primary="true"/> <p:output port="in-memory" sequence="true"> <p:pipe step="epub2-to-epub3" port="result.in-memory"/> </p:output> <px:epub2-to-epub3 name="epub2-to-epub3"> <p:input port="source.in-memory"> <p:pipe step="main" port="source.in-memory"/> </p:input> <p:with-option name="result-base" select="if ($epub3-output-dir!='') then $epub3-output-dir else resolve-uri('epub3/',$temp-dir)"/> </px:epub2-to-epub3> </p:otherwise> </p:choose> <px:epub3-to-epub3 braille="false" name="tts" px:progress="1/4"> <p:input port="source.in-memory"> <p:pipe step="upgrade" port="in-memory"/> </p:input> <p:with-option name="tts" select="$tts"/> <p:with-option name="tts-audio-file-type" select="$tts-audio-file-type"/> <p:input port="tts-config"> <p:pipe step="main" port="tts-config"/> </p:input> <p:with-option name="stylesheet" select="$stylesheet"/> <p:with-option name="lexicon" select="$lexicon"/> <p:with-option name="temp-dir" select="$temp-dir"/> <p:with-option name="result-base" select="if ($epub3-output-dir!='') then $epub3-output-dir else resolve-uri('epub3/',$temp-dir)"/> </px:epub3-to-epub3> <p:try name="daisy" px:progress="2/4"> <p:group> <p:output port="status" primary="true"/> <p:output port="daisy202.fileset"> <p:pipe step="daisy202" port="result.fileset"/> </p:output> <p:output port="daisy202.in-memory" sequence="true"> <p:pipe step="daisy202" port="result.in-memory"/> </p:output> <p:output port="daisy3.fileset"> <p:pipe step="daisy3" port="result.fileset"/> </p:output> <p:output port="daisy3.in-memory" sequence="true"> <p:pipe step="daisy3" port="result.in-memory"/> </p:output> <px:epub3-to-daisy202 name="daisy202" px:progress="1/2" px:message="Converting to DAISY 2.02"> <p:input port="source.in-memory"> <p:pipe step="tts" port="result.in-memory"/> </p:input> <p:with-option name="output-dir" select="$daisy202-output-dir"/> </px:epub3-to-daisy202> <p:sink/> <px:epub3-to-daisy3 name="daisy3" px:progress="1/2" px:message="Converting to DAISY 3"> <p:input port="source.fileset"> <p:pipe step="tts" port="result.fileset"/> </p:input> <p:input port="source.in-memory"> <p:pipe step="tts" port="result.in-memory"/> </p:input> <p:with-option name="output-dir" select="$daisy3-output-dir"/> </px:epub3-to-daisy3> <p:sink/> <p:identity> <p:input port="source"> <p:inline> <d:validation-status result="ok"/> </p:inline> </p:input> </p:identity> </p:group> <p:catch name="catch"> <p:output port="status" primary="true"/> <p:output port="daisy202.fileset"> <p:inline><d:fileset/></p:inline> </p:output> <p:output port="daisy202.in-memory" sequence="true"> <p:empty/> </p:output> <p:output port="daisy3.fileset"> <p:inline><d:fileset/></p:inline> </p:output> <p:output port="daisy3.in-memory" sequence="true"> <p:empty/> </p:output> <p:identity> <p:input port="source"> <p:inline> <d:validation-status result="error"/> </p:inline> </p:input> </p:identity> <px:message> <p:input port="error"> <p:pipe step="catch" port="error"/> </p:input> </px:message> <p:identity px:message="Failed to convert to DAISY 2.02 and DAISY 3" px:message-severity="ERROR"/> </p:catch> </p:try> </p:declare-step>