<
p:declare-step xmlns: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:cx=
"http://xmlcalabash.com/ns/extensions" xmlns:xs=
"http://www.w3.org/2001/XMLSchema" xmlns:dc=
"http://purl.org/dc/elements/1.1/" xmlns:daisy=
"http://www.daisy.org/ns/pipeline/" xmlns:obfl=
"http://www.daisy.org/ns/2011/obfl" version=
"1.0" type=
"px:obfl-to-pef" name=
"main">
<
p:input port=
"source" sequence=
"false"/>
<
p:output port=
"result" sequence=
"false"/>
<
p:option name=
"identifier" required=
"false" select=
"''"/>
<
p:input port=
"parameters" kind=
"parameter" primary=
"false"/>
<
p:declare-step type=
"pxi:obfl-to-pef">
<
p:input port=
"source" sequence=
"false"/>
<
p:output port=
"result" sequence=
"false"/>
<
p:option name=
"locale" required=
"true"/>
<
p:option name=
"mode" required=
"true"/>
<
p:option name=
"braille-charset" required=
"true"/>
<
p:option name=
"pages-per-sheet" cx:as=
"xs:integer" required=
"false" select=
"2"/>
<
p:option name=
"identifier" required=
"false" select=
"''"/>
<
p:option name=
"style-type" required=
"false" select=
"''"/>
<
p:option name=
"css-text-transform-definitions" required=
"false" select=
"''"/>
<
p:option name=
"css-hyphenation-resource-definitions" required=
"false" select=
"''"/>
<
p:option name=
"css-counter-style-definitions" required=
"false" select=
"''"/>
<
p:option name=
"has-volume-transition" required=
"true"/>
<
p:input port=
"parameters" kind=
"parameter" primary=
"false"/>
</
p:declare-step>
<
p:import href=
"obfl-normalize-space.xpl">
<
p:documentation>
pxi:obfl-normalize-space
</
p:documentation>
</
p:import>
<
p:variable name=
"imply-text-transform-none-on-braille-content" select=
"true()"/>
<
pxi:obfl-normalize-space px:progress=
".10"/>
<
p:choose>
<
p:when test=
"$imply-text-transform-none-on-braille-content and /obfl:obfl/obfl:meta/daisy:style-type[1][string(.)='text/css']">
<
p:label-elements match=
"*[@xml:lang][not(@translate)]" attribute=
"translate" label=
"if (tokenize(@xml:lang,'-')='Brai') then 'pre-translated-text-css' else (ancestor::*[@translate][1]/string(@translate),'')[1]"/>
</
p:when>
<
p:otherwise>
<
p:identity/>
</
p:otherwise>
</
p:choose>
<
p:add-attribute match=
"*[@translate='pre-translated-text-css']" attribute-name=
"translate" attribute-value=
"(input:braille)(input:text-css)(output:braille)"/>
<
p:choose>
<
p:when test=
"exists(/obfl:obfl/obfl:meta/daisy:braille-charset)">
<
p:label-elements match=
"*[@translate[not(.='')]]" attribute=
"translate" label=
"concat(@translate,'(braille-charset:"',/obfl:obfl/obfl:meta/daisy:braille-charset,'")')"/>
</
p:when>
<
p:otherwise>
<
p:identity/>
</
p:otherwise>
</
p:choose>
<
p:delete match=
"/obfl:obfl/obfl:meta/daisy:style-type">
</
p:delete>
<
p:delete match=
"/obfl:obfl/obfl:meta/daisy:default-mode">
</
p:delete>
<
p:delete match=
"/obfl:obfl/obfl:meta/daisy:pages-per-sheet">
</
p:delete>
<
p:delete match=
"/obfl:obfl/obfl:meta/daisy:css-text-transform-definitions">
</
p:delete>
<
p:delete match=
"/obfl:obfl/obfl:meta/daisy:css-hyphenation-resource-definitions">
</
p:delete>
<
p:delete match=
"/obfl:obfl/obfl:meta/daisy:css-counter-style-definitions">
</
p:delete>
<
p:delete match=
"/obfl:obfl/obfl:meta/daisy:braille-charset">
</
p:delete>
<
pxi:obfl-to-pef px:progress=
".90">
<
p:with-option name=
"locale" select=
"(/obfl:obfl/obfl:meta/dc:language, /obfl:obfl/@xml:lang, 'und')[1]"/>
<
p:with-option name=
"mode" select=
"/obfl:obfl/obfl:meta/daisy:default-mode">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:with-option name=
"braille-charset" select=
"/obfl:obfl/obfl:meta/daisy:braille-charset">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:with-option name=
"pages-per-sheet" select=
"(/obfl:obfl/obfl:meta/daisy:pages-per-sheet /xs:integer(number(string(.))),2)[1]">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:with-option name=
"identifier" select=
"$identifier"/>
<
p:with-option name=
"style-type" select=
"/obfl:obfl/obfl:meta/daisy:style-type[1]">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:with-option name=
"css-text-transform-definitions" select=
"/obfl:obfl/obfl:meta/daisy:css-text-transform-definitions">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:with-option name=
"css-hyphenation-resource-definitions" select=
"/obfl:obfl/obfl:meta/daisy:css-hyphenation-resource-definitions">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:with-option name=
"css-counter-style-definitions" select=
"/obfl:obfl/obfl:meta/daisy:css-counter-style-definitions">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:with-option name=
"has-volume-transition" select=
"if (/*/obfl:volume-transition) then 'true' else 'false'">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:input port=
"parameters">
<
p:pipe step=
"main" port=
"parameters"/>
</
p:input>
</
pxi:obfl-to-pef>
</
p:declare-step>