<p:declare-steptype="dedicon:dtbook-to-pef"version="1.0"exclude-inline-prefixes="#all"name="main">
<p:documentation>
<h1px:role="name">DTBook to PEF (Dedicon)</h1><ppx:role="desc">Transforms a DTBook (DAISY 3 XML) document into a PEF.</p>
</p:documentation>
<p:inputport="source"primary="true"px:name="source"px:media-type="application/x-dtbook+xml"><p:documentation>
<h2px:role="name">Input DTBook</h2>
</p:documentation></p:input><p:optionname="stylesheet"select="' http://www.daisy.org/pipeline/modules/braille/dtbook-to-pef/xsl/volume-breaking.xsl http://www.dedicon.nl/pipeline/modules/braille/volume-breaking.scss http://www.dedicon.nl/pipeline/modules/braille/default.scss'"px:sequence="true"required="false"px:type="px:dtbook-to-pef.script-stylesheet"px:media-type="text/css application/xslt+xml"><p:documentation>
<h2px:role="name">Style sheets</h2><ppx:role="desc"xml:space="preserve">A list of XSLT or CSS/SASS style sheets to apply.
Must be a space separated list of URIs, absolute or relative to the input.
Style sheets can also be associated with the source in other ways: linked (using an
['xml-stylesheet' processing instruction](https://www.w3.org/TR/xml-stylesheet) or a ['link'
element](https://www.w3.org/Style/styling-XML#External)), embedded (using a ['style'
element](https://www.w3.org/Style/styling-XML#Embedded)) and/or inlined (using '[style'
attributes](https://www.w3.org/TR/css-style-attr/)).
Style sheets are applied to the document in the following way: XSLT style sheets are applied before
CSS/SASS style sheets. XSLT style sheets are applied one by one, first the ones specified through
this option, then the ones associated with the source document, in the order in which they are
specified.
All CSS/SASS style sheets are applied at once, but the order in which they are specified (first the
ones specified through this option, then the ones associated with the source document) has an
influence on the [cascading order](https://www.w3.org/TR/CSS2/cascade.html#cascading-order).
CSS/SASS style sheets are interpreted according to [braille
CSS](http://braillespecs.github.io/braille-css) rules.
For info on how to use SASS (Syntactically Awesome StyleSheets) see the [SASS
manual](http://sass-lang.com/documentation/file.SASS_REFERENCE.html).</p>
</p:documentation></p:option><p:optionname="include-preview"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Include preview</h2><ppx:role="desc"xml:space="preserve">Whether or not to include a preview of the PEF in HTML.</p>
</p:documentation></p:option><p:optionname="include-brf"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Include plain text file (BRF)</h2><ppx:role="desc"xml:space="preserve">Whether or not to include a plain text ASCII version of the PEF.</p>
</p:documentation></p:option><p:optionname="include-metadata"required="false"px:type="boolean"select="'true'">
<p:documentation>
<h2px:role="name">Include metadata file</h2>
</p:documentation>
</p:option><p:optionname="metadata-date"select="''"/><p:optionname="include-obfl"select="'false'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Include OBFL</h2><ppx:role="desc"xml:space="preserve">Keeps the intermediary OBFL-file for debugging.</p>
</p:documentation></p:option><p:optionname="add-boilerplate"required="false"px:type="boolean"select="'true'">
<p:documentation>
<h2px:role="name">Add boilerplate text</h2><ppx:role="desc">When enabled, and when the input has a `docauthor` element, will insert boilerplate text such as a title page.</p>
</p:documentation>
</p:option><p:optionname="page-width"select="'-1'"required="false"px:type="integer">
<p:documentation>
<h2px:role="name">Page layout: Page width
</h2><ppx:role="desc"xml:space="preserve">The number of columns available for printing.
Makes the variable `$page-width` available in style sheets and includes the following rule by default:
~~~sass
@page {
size: $page-width $page-height;
}
~~~
See the CSS specification for more info:
- the [`@page`](http://braillespecs.github.io/braille-css/#h4_the-page-rule) rule
- the [`size`](http://braillespecs.github.io/braille-css/#the-size-property) property
Use `-1` to compute this from metadata.</p>
</p:documentation>
</p:option><p:optionname="page-height"select="'-1'"required="false"px:type="integer">
<p:documentation>
<h2px:role="name">Page layout: Page height
</h2><ppx:role="desc"xml:space="preserve">The number of rows available for printing.
Makes the variable `$page-height` available in style sheets and includes the following rule by default:
~~~sass
@page {
size: $page-width $page-height;
}
~~~
See the CSS specification for more info:
- the [`@page`](http://braillespecs.github.io/braille-css/#h4_the-page-rule) rule
- the [`size`](http://braillespecs.github.io/braille-css/#the-size-property) property
Use `-1` to compute this from metadata.</p>
</p:documentation>
</p:option><p:optionname="printing"select="'duplex'">
<p:pipeinfo>
<px:type>
<choice>
<value>simplex</value>
<documentation>Simplex</documentation>
<value>simplex-form-feeds</value>
<documentation>Simplex with extra form feeds</documentation>
<value>duplex</value>
<documentation>Duplex</documentation>
</choice>
</px:type><px:type>
<choice>
<value>simplex</value>
<documentation>Simplex</documentation>
<value>simplex-form-feeds</value>
<documentation>Simplex with extra form feeds</documentation>
<value>duplex</value>
<documentation>Duplex</documentation>
</choice>
</px:type>
</p:pipeinfo>
<p:documentation>
<h2px:role="name">Page layout: Printing</h2><ppx:role="desc"xml:space="preserve">Option `Simplex with extra form feeds` adds extra form feeds to the braille files to enforce single sided printing.</p>
</p:documentation>
</p:option><p:optionname="hyphenation"select="'from-meta'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Translation/formatting of text: Hyphenation</h2><ppx:role="desc"xml:space="preserve">When enabled, will automatically hyphenate text.
Makes the variable `$hyphenation` available in style sheets and includes the following rule by
default:
~~~sass
@if $hyphenation {
:root {
hyphens: auto;
}
}
~~~
See the CSS specification for more info:
- the [`hyphens`](http://braillespecs.github.io/braille-css/#the-hyphens-property) property
</p>
</p:documentation>
<p:pipeinfo>
<px:type>
<choice>
<value>true</value>
<documentation>Yes</documentation>
<value>false</value>
<documentation>No</documentation>
<value>from-meta</value>
<documentation>Use value from metadata field</documentation>
</choice>
</px:type><px:type>
<choice>
<value>true</value>
<documentation>Yes</documentation>
<value>false</value>
<documentation>No</documentation>
<value>from-meta</value>
<documentation>Use value from metadata field</documentation>
</choice>
</px:type>
</p:pipeinfo>
</p:option><p:optionname="line-spacing"select="'single'"required="false"pxd:type="px:xml-to-pef-line-spacing"><p:documentation>
<h2px:role="name">Translation/formatting of text: Line spacing</h2><ppx:role="desc"xml:space="preserve">Single or double line spacing.
Makes the variable `$line-spacing` available in style sheets and includes the following rule by
default:
~~~sass
@if $line-spacing == double {
:root {
line-height: 2;
}
}
~~~
See the CSS specification for more info:
- the [`line-height`](http://braillespecs.github.io/braille-css/#h3_the-line-height-property)
property
</p>
</p:documentation></p:option><p:optionname="capital-letters"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Translation/formatting of text: Capital letters</h2><ppx:role="desc"xml:space="preserve">When enabled, will indicate capital letters.
Makes the variable `$capital-letters` available in style sheets and includes the following rule by
default:
~~~sass
@if $capital-letters != true {
:root {
text-transform: lowercase;
}
}
~~~</p>
</p:documentation></p:option><p:optionname="include-captions"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Block elements: Include captions</h2><ppx:role="desc"xml:space="preserve">When enabled, will include captions for images, tables, and so on.
Makes the variable `$include-captions` available in style sheets and includes the following rule by
default:
~~~sass
caption {
display: if($include-captions, block, none);
}
~~~</p>
</p:documentation></p:option><p:optionname="include-images"select="'false'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Block elements: Include images</h2><ppx:role="desc"xml:space="preserve">When enabled, will include the alt text of the images. When disabled, the images will be completely removed.
Makes the variable `$include-images` available in style sheets and includes the following rule by
default:
~~~sass
@if $include-images {
img::after {
content: attr(alt);
}
}
~~~</p>
</p:documentation></p:option><p:optionname="include-image-groups"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Block elements: Include image groups</h2><ppx:role="desc"xml:space="preserve">**Not implemented**</p>
</p:documentation></p:option><p:optionname="include-line-groups"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Block elements: Include line groups</h2><ppx:role="desc"xml:space="preserve">When disabled, lines in a linegroup are joined together to form one block.
Makes the variable `$include-line-groups` available in style sheets and includes the following rule
by default:
~~~sass
linegroup line {
display: if($include-line-groups, block, inline);
}
~~~</p>
</p:documentation></p:option><p:optionname="include-production-notes"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Inline elements: Include production notes</h2><ppx:role="desc"xml:space="preserve">When enabled, production notes are included in the content.
Makes the variable `$include-production-notes` available in style sheets and includes the following
rule by default:
~~~sass
prodnote {
display: if($include-production-notes, block, none);
}
~~~</p>
</p:documentation></p:option><p:optionname="show-braille-page-numbers"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Page numbers: Show braille page numbers</h2><ppx:role="desc"xml:space="preserve">When enabled, will number braille pages.
Makes the variable `$show-braille-page-numbers` available in style sheets. In order to use the
variable include a rule like the following in your custom style sheet:
~~~sass
@if $show-braille-page-numbers {
@page {
@top-right {
content: counter(page);
}
}
}
~~~
This will create a page number in the top right corner of every braille page.
See the CSS specification for more info:
- the [`@page`](http://braillespecs.github.io/braille-css/#h4_the-page-rule) rule
- the
[`counter()`](http://braillespecs.github.io/braille-css/#printing-counters-the-counter-function)
function
</p>
</p:documentation></p:option><p:optionname="show-print-page-numbers"select="'true'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Page numbers: Show print page numbers</h2><ppx:role="desc"xml:space="preserve">When enabled, will indicate original page numbers.
Makes the variable `$show-print-page-numbers` available in style sheets and includes the following
rule by default:
~~~sass
@if $show-print-page-numbers {
pagenum {
string-set: print-page content();
}
}
~~~
In order to use the `print-page` string include a rule like the following in your custom style
sheet:
~~~css
@page {
@bottom-right {
content: string(print-page);
}
}
~~~
See the CSS specification for more info:
- the [`string-set`](http://braillespecs.github.io/braille-css/#h4_the-string-set-property) property
- the [`@page`](http://braillespecs.github.io/braille-css/#h4_the-page-rule) rule
- the [`string()`](http://braillespecs.github.io/braille-css/#h4_the-string-function) function
</p>
</p:documentation></p:option><p:optionname="show-inline-print-page-numbers"select="'from-meta'">
<p:pipeinfo>
<px:type>
<choice>
<value>true</value>
<documentation>Yes</documentation>
<value>false</value>
<documentation>No</documentation>
<value>from-meta</value>
<documentation>Use value from metadata field</documentation>
</choice>
</px:type><px:type>
<choice>
<value>true</value>
<documentation>Yes</documentation>
<value>false</value>
<documentation>No</documentation>
<value>from-meta</value>
<documentation>Use value from metadata field</documentation>
</choice>
</px:type>
</p:pipeinfo>
<p:documentation>
<h2px:role="name">Page numbers: Show inline print page numbers</h2>
</p:documentation>
</p:option><p:optionname="force-braille-page-break"select="'false'"required="false"px:type="boolean"><p:documentation>
<h2px:role="name">Page numbers: Force braille page break</h2><ppx:role="desc"xml:space="preserve">Force braille page breaks at print page breaks.
Makes the variable `$force-braille-page-break` available in style sheets and includes the following
rule by default:
~~~sass
@if $force-braille-page-break {
pagenum {
page-break-before: always;
}
}
~~~
See the CSS specification for more info:
- the [`page-break-before`](http://braillespecs.github.io/braille-css/#h4_controlling-page-breaks)
property
</p>
</p:documentation></p:option><p:optionname="toc-depth"select="'6'"required="false"px:type="integer"><p:documentation>
<h2px:role="name">Table of contents: Table of contents depth</h2><ppx:role="desc"xml:space="preserve">The depth of the table of contents hierarchy to include. '0' means no table of contents.
A table of contents will be generated from the heading elements present in the document: from `h1`
elements if the specified value for "depth" is 1, from `h1` and `h2` elements if the specified value
is 2, etc. The resulting table of contents has the following nested structure:
~~~xml
<list id="generated-document-toc">
<li>
<a href="#ch_1">Chapter 1</a>
<list>
<li>
<a href="#ch_1_1">1.1</a>
...
</li>
<li>
<a href="#ch_1_2">1.2</a>
...
</li>
...
</list>
</li>
...
</list>
~~~
Another one of these is generated but with ID `generated-volume-toc`. `ch_1`, `ch_1_2` etc. are the
IDs of the heading elements from which the list was constructed, and the content of the links are
exact copies of the content of the heading elements. By default the list is not rendered. The list
should be styled and positioned with CSS. The following rules are included by default:
~~~css
#generated-document-toc {
flow: document-toc;
display: -obfl-toc;
-obfl-toc-range: document;
}
#generated-volume-toc {
flow: volume-toc;
display: -obfl-toc;
-obfl-toc-range: volume;
}
~~~
This means that a document range table of contents is added to the named flow called "document-toc",
and a volume range table of contents is added to the named flow called "volume-toc". In order to
consume these named flows use the function `flow()`. For example, to position the document range
table of contents at the beginning of the first volume, and to repeat the volume range table of
content at the beginning of every other volume, include the following additional rules:
~~~css
@volume {
@begin {
content: flow(volume-toc);
}
}
@volume:first {
@begin {
content: flow(document-toc);
}
}
~~~
See the CSS specification for more info:
- the [`display:
obfl-toc`](http://braillespecs.github.io/braille-css/obfl#extending-the-display-property-with--obfl-toc)
value
- the [`flow`](http://braillespecs.github.io/braille-css/#the-flow-property) property
- the [`flow()`](http://braillespecs.github.io/braille-css/#h4_the-flow-function) function
- the [`@volume`](http://braillespecs.github.io/braille-css/#h3_the-volume-rule) rule
- the [`@begin`](http://braillespecs.github.io/braille-css/#h3_the-begin-and-end-rules) rule
</p>
</p:documentation></p:option><p:optionname="include-document-toc-in-last-volume"required="false"select="'from-meta'">
<p:pipeinfo>
<px:type>
<choice>
<value>true</value>
<documentation>Yes</documentation>
<value>false</value>
<documentation>No</documentation>
<value>from-meta</value>
<documentation>Use value from metadata field</documentation>
</choice>
</px:type><px:type>
<choice>
<value>true</value>
<documentation>Yes</documentation>
<value>false</value>
<documentation>No</documentation>
<value>from-meta</value>
<documentation>Use value from metadata field</documentation>
</choice>
</px:type>
</p:pipeinfo>
<p:documentation>
<h2px:role="name">Table of contents: Include document TOC</h2><ppx:role="desc"xml:space="preserve">Whether or not to include a document-level TOC in the last volume.</p>
</p:documentation>
</p:option><p:optionname="include-print-toc"required="false"px:type="boolean"select="'true'">
<p:documentation>
<h2px:role="name">Table of contents: Include print TOC</h2><ppx:role="desc"xml:space="preserve">Whether or not to include a print TOC.</p>
</p:documentation>
</p:option><p:optionname="include-symbols-list"required="false"px:type="boolean"select="'true'">
<p:documentation>
<h2px:role="name">Include symbols list</h2><ppx:role="desc"xml:space="preserve">When enabled, a list of symbols and their descriptions is included in the first volume.</p>
</p:documentation>
</p:option><p:optionname="symbols-code"select="'http://www.dedicon.nl/pipeline/modules/braille/symbols_code.xml'">
<p:documentation>
<h2px:role="name">Symbols list</h2><ppx:role="desc"xml:space="preserve">If left unchanged, the default symbols list will be used.</p>
</p:documentation>
</p:option><p:optionname="symbols-list-header"required="false"px:type="string"select="'Symbolenlijst'">
<p:documentation>
<h2px:role="name">Symbols list header</h2>
</p:documentation>
</p:option><p:optionname="jacket-header"required="false"px:type="string"select="'Flaptekst'">
<p:documentation>
<h2px:role="name">Jacket header</h2>
</p:documentation>
</p:option><p:optionname="move-print-cover-to-first-volume"required="false"px:type="boolean"select="'true'">
<p:documentation>
<h2px:role="name">Volumes: Move print cover to first volume</h2><ppx:role="desc">When enabled, and when the input has a `level1` element with class `flap`, `jacket_copy` or `jacketcopy`, will move that cover to the first volume.</p>
</p:documentation>
</p:option><p:optionname="move-print-colophon-to-last-volume"required="false"select="'from-meta'">
<p:pipeinfo>
<px:type>
<choice>
<value>true</value>
<documentation>Yes</documentation>
<value>false</value>
<documentation>No</documentation>
<value>from-meta</value>
<documentation>Use value from metadata field</documentation>
</choice>
</px:type><px:type>
<choice>
<value>true</value>
<documentation>Yes</documentation>
<value>false</value>
<documentation>No</documentation>
<value>from-meta</value>
<documentation>Use value from metadata field</documentation>
</choice>
</px:type>
</p:pipeinfo>
<p:documentation>
<h2px:role="name">Volumes: Move print colophon to last volume</h2><ppx:role="desc">When enabled, and when the input has a `level1` element with class `colophon`, will move that colophon to the last volume.</p>
</p:documentation>
</p:option><p:optionname="maximum-number-of-sheets"select="'-1'"required="false"px:type="integer">
<p:documentation>
<h2px:role="name">Volumes: Maximum number of sheets
</h2><ppx:role="desc"xml:space="preserve">The maximum number of sheets in a volume.
Makes the variable `$maximum-number-of-sheets` available in style sheets and includes the following
rule by default:
~~~sass
@volume {
max-length: $maximum-number-of-sheets;
}
~~~
See the CSS specification for more info:
- the [`@volume`](http://braillespecs.github.io/braille-css/#h3_the-volume-rule) rule
- the [`max-length`](http://braillespecs.github.io/braille-css/#h3_the-length-properties) property
Use `-1` to compute this from metadata.</p>
</p:documentation>
</p:option><p:optionname="volume-back-cover-empty"required="false"px:type="boolean"select="'true'">
<p:documentation>
<h2px:role="name">Volumes: The back cover must be empty</h2><ppx:role="desc"xml:space="preserve">Applies to duplex printing. When enabled, the last page of a printed volume will contain no text and can have pits only. If the number of pages of a volume is a 4-fold and the last page is not empty, an extra page will be appended.</p>
</p:documentation>
</p:option><p:optionname="pef-output-dir"required="true"px:output="result"px:type="anyDirURI"px:media-type="application/x-pef+xml"><p:documentation>
<h2px:role="name">PEF</h2><ppx:role="desc">The PEF.</p>
</p:documentation></p:option><p:optionname="brf-output-dir"select="''"required="false"px:output="result"px:type="anyDirURI"px:media-type="text"><p:documentation>
<h2px:role="name">BRF</h2><ppx:role="desc">A plain text ASCII version of the PEF.</p>
</p:documentation></p:option><p:optionname="preview-output-dir"select="''"required="false"px:output="result"px:type="anyDirURI"px:media-type="text/html"><p:documentation>
<h2px:role="name">Preview</h2><ppx:role="desc">An HTML preview of the PEF.</p>
</p:documentation></p:option>
<p:variablename="file-format"px:type="string"select="'(table:"com_braillo.BrailloTableProvider.TableType.BRAILLO_6DOT_031_01")(line-breaks:dos)(pad:both)(charset:"IBM00858")(file-extension:".brl")'"/>
<p:importhref="http://www.daisy.org/pipeline/modules/braille/dtbook-to-pef/library.xpl"/>
<p:importhref="http://www.daisy.org/pipeline/modules/braille/common-utils/library.xpl"/>
<p:importhref="http://www.daisy.org/pipeline/modules/braille/pef-utils/library.xpl"/>
<p:importhref="http://www.daisy.org/pipeline/modules/file-utils/library.xpl"/>
<p:importhref="http://www.daisy.org/pipeline/modules/common-utils/library.xpl"/>
<p:importhref="http://www.daisy.org/pipeline/modules/dtbook-utils/library.xpl"/>
<p:importhref="http://www.dedicon.nl/pipeline/modules/braille/library.xpl"/>
<p:in-scope-namesname="in-scope-names"/>
<px:merge-parameters>
<p:inputport="source">
<p:pipeport="result"step="in-scope-names"/>
</p:input>
</px:merge-parameters>
<px:delete-parametersparameter-names="stylesheet symbols-code ascii-table include-brf include-preview include-obfl pef-output-dir brf-output-dir preview-output-dir temp-dir"/>
<px:add-parameters>
<p:with-paramname="skip-margin-top-of-page"select="true()"/>
<p:with-paramname="page-width"select="if ($page-width='-1') then if (//dtb:meta[@name='prod:docType']/@content='ro') then '28' else if (//dtb:meta[@name='prod:docType']/@content='sv') then '33' else '28' else $page-width">
<p:pipestep="main"port="source"/>
</p:with-param>
<p:with-paramname="page-height"select="if ($page-height='-1') then if (//dtb:meta[@name='prod:docType']/@content='ro') then '26' else if (//dtb:meta[@name='prod:docType']/@content='sv') then '27' else '26' else $page-height">
<p:pipestep="main"port="source"/>
</p:with-param>
<p:with-paramname="maximum-number-of-sheets"select="if ($maximum-number-of-sheets='-1') then if (//dtb:meta[@name='prod:docType']/@content='ro') then '35' else if (//dtb:meta[@name='prod:docType']/@content='sv') then '37' else '35' else $maximum-number-of-sheets">
<p:pipestep="main"port="source"/>
</p:with-param>
<p:with-paramname="hyphenation"select="if ($hyphenation='from-meta') then (//dtb:meta[@name='prod:docHyphenate']/@content,'Y')[1]='Y' else $hyphenation='true'">
<p:pipestep="main"port="source"/>
</p:with-param>
<p:with-paramname="show-inline-print-page-numbers"select="if ($show-inline-print-page-numbers='from-meta') then //dtb:meta[@name='prod:docType']/@content='sv' else $show-inline-print-page-numbers='true'">
<p:pipestep="main"port="source"/>
</p:with-param>
<p:with-paramname="include-document-toc-in-last-volume"select="if ($include-document-toc-in-last-volume='from-meta') then //dtb:meta[@name='prod:docType']/@content='ro' else $include-document-toc-in-last-volume='true'">
<p:pipestep="main"port="source"/>
</p:with-param>
<p:with-paramname="move-print-colophon-to-last-volume"select="if ($move-print-colophon-to-last-volume='from-meta') then //dtb:meta[@name='prod:docType']/@content='sv' else $move-print-colophon-to-last-volume='true'">
<p:pipestep="main"port="source"/>
</p:with-param>
<p:with-paramname="duplex"select="$printing='duplex'">
<p:pipestep="main"port="source"/>
</p:with-param>
<p:with-paramname="ascii-file-format"select="$file-format">
<p:pipestep="main"port="source"/>
</p:with-param>
</px:add-parameters>
<p:identityname="input-options"/>
<p:sink/>
<px:tempdirname="temp-dir">
<p:with-optionname="href"select="if ($temp-dir!='') then $temp-dir else $pef-output-dir"/>
</px:tempdir>
<p:sink/>
<dedicon:messagereset="true"message="Start Dedicon pre-processing">
<p:inputport="source">
<p:pipestep="main"port="source"/>
</p:input>
</dedicon:message>
<p:choose>
<p:whentest="$include-print-toc = 'false'">
<dedicon:messagemessage="Removing print TOC"/>
<dedicon:remove-print-toc/>
</p:when>
<p:otherwise>
<dedicon:messageseverity="TRACE"message="Keeping print TOC"/>
</p:otherwise>
</p:choose>
<dedicon:messagemessage="Applying fix for backslashes in attribute src"/>
<dedicon:src-backslash-fix/>
<dedicon:messagemessage="Moving notes after their noteref"/>
<dedicon:move-notes/>
<p:choose>
<p:whentest="$move-print-cover-to-first-volume='true'">
<dedicon:messagemessage="Managing jacket"/>
<dedicon:jacket>
<p:with-optionname="jacket-header"select="$jacket-header"/>
</dedicon:jacket>
</p:when>
<p:otherwise>
<dedicon:messageseverity="TRACE"message="Skipping jacket"/>
</p:otherwise>
</p:choose>
<p:choose>
<p:whentest="$include-symbols-list='true'">
<dedicon:messagemessage="Including symbols list"/>
<dedicon:symbols-list>
<p:with-optionname="symbols-code"select="$symbols-code"/>
<p:with-optionname="symbols-list-header"select="$symbols-list-header"/>
</dedicon:symbols-list>
</p:when>
<p:otherwise>
<dedicon:messageseverity="TRACE"message="Skipping symbols list"/>
</p:otherwise>
</p:choose>
<p:choose>
<p:whentest="$add-boilerplate='true'">
<dedicon:messagemessage="Adding boilerplate"/>
<dedicon:add-boilerplate>
<p:inputport="parameters">
<p:pipestep="input-options"port="result"/>
</p:input>
</dedicon:add-boilerplate>
</p:when>
<p:otherwise>
<dedicon:messageseverity="TRACE"message="Skipping boilerplate"/>
</p:otherwise>
</p:choose>
<dedicon:messagemessage="End Dedicon pre-processing"/>
<px:set-base-uribase-uri="file:/irrelevant.xml"/>
<px:dtbook-loadname="load"/>
<px:dtbook-to-pefdefault-stylesheet="http://www.daisy.org/pipeline/modules/braille/dtbook-to-pef/css/default.css"transform="(formatter:dotify)(translator:dedicon)"name="convert">
<p:inputport="source.in-memory">
<p:pipestep="load"port="in-memory.out"/>
</p:input>
<p:with-optionname="temp-dir"select="string(/c:result)">
<p:pipestep="temp-dir"port="result"/>
</p:with-option>
<p:with-optionname="stylesheet"select="$stylesheet"/>
<p:with-optionname="include-obfl"select="$include-obfl"/>
<p:inputport="parameters">
<p:pipeport="result"step="input-options"/>
</p:input>
</px:dtbook-to-pef>
<p:group>
<p:variablename="identifier"select="//dtb:meta[@name='dc:Identifier']/@content">
<p:pipestep="main"port="source"/>
</p:variable>
<p:variablename="name"select="if ($identifier) then $identifier else replace(p:base-uri(/),'^.*/([^/]*)\.[^/\.]*$','$1')">
<p:pipestep="main"port="source"/>
</p:variable>
<p:variablename="title"select="//dtb:meta[@name='dc:Title']/@content">
<p:pipestep="main"port="source"/>
</p:variable>
<p:for-each>
<p:choose>
<p:whentest="$volume-back-cover-empty='true'">
<dedicon:messagemessage="Volume back cover will be empty"/>
<dedicon:empty-back-cover>
<p:with-optionname="xquery"select="resolve-uri('../../xquery/empty-back-cover.xql')"/>
</dedicon:empty-back-cover>
</p:when>
<p:otherwise>
<dedicon:messageseverity="TRACE"message="Skipping ''volume back cover will be empty''"/>
</p:otherwise>
</p:choose>
<p:identityname="pef"/>
<p:group>
<p:variablename="preview-href"select=" if ($include-preview='true' and $preview-output-dir!='') then concat($preview-output-dir,'/',$name,'.pef.html') else '' "/>
<p:variablename="brf-file-format"select="$file-format"/>
<p:variablename="brf-name-pattern"select="concat('p',$name,'_{}')"/>
<p:variablename="brf-number-width"select="3"/>
<p:variablename="brf-dir-href"select=" if ($include-brf='true') then if ($brf-output-dir!='') then $brf-output-dir else if ($pef-output-dir!='') then $pef-output-dir else '' else '' "/>
<pef:store>
<p:with-optionname="href"select="concat($pef-output-dir,'/',$name,'.pef')"/>
<p:with-optionname="preview-href"select="$preview-href"/>
<p:with-optionname="brf-dir-href"select="$brf-dir-href"/>
<p:with-optionname="brf-file-format"select="$brf-file-format"/>
<p:with-optionname="brf-name-pattern"select="$brf-name-pattern"/>
<p:with-optionname="brf-number-width"select="$brf-number-width"/>
</pef:store>
<dedicon:messagemessage="Inserting newline in BRL files">
<p:inputport="source">
<p:pipeport="result"step="pef"/>
</p:input>
</dedicon:message>
<dedicon:brl-urisname="brl-uris">
<p:with-optionname="xquery"select="resolve-uri('../../xquery/brl-uris.xql')"/>
<p:with-optionname="brf-dir-href"select="$brf-dir-href"/>
<p:with-optionname="brf-file-format"select="$brf-file-format"/>
<p:with-optionname="brf-name-pattern"select="$brf-name-pattern"/>
<p:with-optionname="brf-number-width"select="$brf-number-width"/>
</dedicon:brl-uris>
<p:for-each>
<dedicon:brl-must-start-with-newline>
<p:with-optionname="brl-uri"select="."/>
</dedicon:brl-must-start-with-newline>
</p:for-each>
<p:choose>
<p:whentest="$printing='simplex'">
<dedicon:messagemessage="Replacing double form feeds in BRL files">
<p:inputport="source">
<p:empty/>
</p:input>
</dedicon:message>
<p:for-each>
<p:iteration-source>
<p:pipestep="brl-uris"port="result"/>
</p:iteration-source>
<dedicon:brl-replace-double-form-feeds>
<p:with-optionname="brl-uri"select="."/>
</dedicon:brl-replace-double-form-feeds>
</p:for-each>
</p:when>
<p:otherwise>
<p:sink>
<p:inputport="source">
<p:empty/>
</p:input>
</p:sink>
</p:otherwise>
</p:choose>
<p:choose>
<p:whentest="$include-metadata='true'">
<dedicon:messagemessage="Storing metadata">
<p:inputport="source">
<p:pipeport="result"step="pef"/>
</p:input>
</dedicon:message>
<dedicon:metadata>
<p:with-optionname="xquery"select="resolve-uri('../../xquery/metadata.xql')"/>
<p:with-optionname="identifier"select="$identifier"/>
<p:with-optionname="brf-file-format"select="$brf-file-format"/>
<p:with-optionname="brf-name-pattern"select="$brf-name-pattern"/>
<p:with-optionname="brf-number-width"select="$brf-number-width"/>
<p:with-optionname="optional-date"select="$metadata-date"/>
</dedicon:metadata>
<p:store>
<p:with-optionname="href"select="concat($pef-output-dir, '/m', $name, '_001.xml')"/>
</p:store>
</p:when>
<p:otherwise>
<dedicon:messageseverity="TRACE"message="Skipping metadata">
<p:inputport="source">
<p:empty/>
</p:input>
</dedicon:message>
<p:sink/>
</p:otherwise>
</p:choose>
<p:choose>
<p:whentest="$preview-href != ''">
<dedicon:messagemessage="Modifying preview">
<p:inputport="source">
<p:empty/>
</p:input>
</dedicon:message>
<dedicon:modify-preview>
<p:with-optionname="preview-uri"select="$preview-href"/>
</dedicon:modify-preview>
</p:when>
<p:otherwise>
<p:sink>
<p:inputport="source">
<p:empty/>
</p:input>
</p:sink>
</p:otherwise>
</p:choose>
</p:group>
</p:for-each>
<p:for-each>
<p:iteration-source>
<p:pipestep="convert"port="obfl"/>
</p:iteration-source>
<dedicon:messagemessage="Storing OBFL"/>
<p:store>
<p:with-optionname="href"select="concat($pef-output-dir,'/',$name,'.obfl')"/>
</p:store>
</p:for-each>
<dedicon:message>
<p:with-optionname="message"select="concat('Finished ''', $title, '''')"/>
<p:inputport="source">
<p:empty/>
</p:input>
</dedicon:message>
<p:sink/>
</p:group>
</p:declare-step>