<
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" version=
"1.0" type=
"px:reshape" name=
"main" exclude-inline-prefixes=
"#all">
<
p:option name=
"can-contain-sentences" required=
"true"/>
<
p:option name=
"cannot-be-sentence-child" required=
"false" select=
"''"/>
<
p:option name=
"special-sentences" required=
"false" select=
"''"/>
<
p:option name=
"output-word-tag" required=
"true"/>
<
p:option name=
"output-sentence-tag" required=
"true"/>
<
p:option name=
"word-attr" required=
"false" select=
"''"/>
<
p:option name=
"word-attr-val" required=
"false" select=
"''"/>
<
p:option name=
"sentence-attr" required=
"false" select=
"''"/>
<
p:option name=
"sentence-attr-val" required=
"false" select=
"''"/>
<
p:option name=
"output-ns" required=
"true"/>
<
p:option name=
"output-subsentence-tag" required=
"true"/>
<
p:option name=
"tmp-word-tag" required=
"true"/>
<
p:option name=
"tmp-sentence-tag" required=
"true"/>
<
p:option name=
"exclusive-word-tag" select=
"'true'"/>
<
p:option name=
"exclusive-sentence-tag" select=
"'true'"/>
<
p:input port=
"source" primary=
"true"/>
<
p:output port=
"result" primary=
"true">
<
p:pipe step=
"result" port=
"result"/>
</
p:output>
<
p:output port=
"sentence-ids">
<
p:pipe step=
"sentence-ids" port=
"result"/>
</
p:output>
<
p:import href=
"http://www.daisy.org/pipeline/modules/file-utils/library.xpl">
<
p:documentation>
px:set-base-uri
</
p:documentation>
</
p:import>
<
p:in-scope-names name=
"options"/>
<
p:identity>
<
p:input port=
"source">
<
p:pipe step=
"main" port=
"source"/>
</
p:input>
</
p:identity>
<
p:group name=
"mark">
<
p:output port=
"result"/>
<
p:add-attribute attribute-name=
"pxi:can-contain-sentences" attribute-value=
"">
<
p:with-option name=
"match" select=
"$can-contain-sentences"/>
</
p:add-attribute>
<
p:add-attribute attribute-name=
"pxi:can-contain-sentences" attribute-value=
"">
<
p:with-option name=
"match" select=
"concat('*:',$output-sentence-tag)"/>
</
p:add-attribute>
<
p:choose>
<
p:when test=
"$special-sentences!=''">
<
p:add-attribute attribute-name=
"pxi:special-sentence" attribute-value=
"">
<
p:with-option name=
"match" select=
"$special-sentences"/>
</
p:add-attribute>
</
p:when>
<
p:otherwise>
<
p:identity/>
</
p:otherwise>
</
p:choose>
<
p:choose>
<
p:when test=
"$cannot-be-sentence-child!=''">
<
p:add-attribute attribute-name=
"pxi:cannot-be-sentence-child" attribute-value=
"">
<
p:with-option name=
"match" select=
"$cannot-be-sentence-child"/>
</
p:add-attribute>
</
p:when>
<
p:otherwise>
<
p:identity/>
</
p:otherwise>
</
p:choose>
</
p:group>
<
p:xslt name=
"distribute">
<
p:with-option name=
"output-base-uri" select=
"base-uri(/*)">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
<
p:input port=
"source">
<
p:pipe step=
"mark" port=
"result"/>
<
p:pipe step=
"options" port=
"result"/>
</
p:input>
<
p:input port=
"stylesheet">
<
p:document href=
"distribute-sentences.xsl"/>
</
p:input>
<
p:input port=
"parameters">
<
p:empty/>
</
p:input>
</
p:xslt>
<
p:xslt name=
"create-valid">
<
p:with-param name=
"output-word-tag" select=
"$output-word-tag"/>
<
p:with-param name=
"output-sentence-tag" select=
"$output-sentence-tag"/>
<
p:with-param name=
"word-attr" select=
"$word-attr"/>
<
p:with-param name=
"word-attr-val" select=
"$word-attr-val"/>
<
p:with-param name=
"sentence-attr" select=
"$sentence-attr"/>
<
p:with-param name=
"sentence-attr-val" select=
"$sentence-attr-val"/>
<
p:with-param name=
"output-ns" select=
"$output-ns"/>
<
p:with-param name=
"output-subsentence-tag" select=
"$output-subsentence-tag"/>
<
p:with-param name=
"exclusive-word-tag" select=
"$exclusive-word-tag"/>
<
p:with-param name=
"exclusive-sentence-tag" select=
"$exclusive-sentence-tag"/>
<
p:input port=
"source">
<
p:pipe step=
"distribute" port=
"result"/>
<
p:pipe step=
"options" port=
"result"/>
</
p:input>
<
p:input port=
"stylesheet">
<
p:document href=
"create-valid-breaks.xsl"/>
</
p:input>
</
p:xslt>
<
px:set-base-uri name=
"result">
<
p:with-option name=
"base-uri" select=
"base-uri(/*)">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
</
px:set-base-uri>
<
p:sink/>
<
px:set-base-uri name=
"sentence-ids">
<
p:documentation>Give the sentence IDs document the same base URI as the source and result documents.</
p:documentation>
<
p:input port=
"source">
<
p:pipe step=
"create-valid" port=
"secondary"/>
</
p:input>
<
p:with-option name=
"base-uri" select=
"base-uri(/*)">
<
p:pipe step=
"main" port=
"source"/>
</
p:with-option>
</
px:set-base-uri>
<
p:sink/>
</
p:declare-step>