
Wraps the p:xslt step. In addition to returning the primary and secondary
results, it attempts to store them to disk.
To use the exc:xslt-save step, declare the exc: prefix
for http://exproc.org/ns/contrib and add the following import
to your pipeline:
<p:import href="https://exproc.org/contrib/ndw/xslt-save/1.0.1.xpl"/>
source. The source to be transformed.stylesheet. The transformation stylesheet.result. The principal result.secondary. Secondary result(s).$show-stored-uris (default: false()). If true, a p:message is output for each stored document.$ignore-failed-store (default: false()). If true, a failed p:store will be ignored (with a message).$parameters. As per p:xslt.$static-parameters. As per p:xslt.$global-context-item. As per p:xslt.$populate-default-collection (default: true()). As per p:xslt.$initial-mode. As per p:xslt.$template-name. As per p:xslt.$output-base-uri. As per p:xslt.$version. As per p:xslt.<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:exc="http://exproc.org/ns/contrib"
type="exc:xslt-save"
name="main" version="3.1">
<p:input port="source" primary="true" sequence="true" content-types="any"/>
<p:input port="stylesheet" content-types="xml"/>
<p:output port="result" primary="true" sequence="true" content-types="any"
pipe="result@xslt"/>
<p:output port="secondary" sequence="true" content-types="any"
pipe="secondary@xslt"/>
<p:option name="show-stored-uris" as="xs:boolean" select="false()"/>
<p:option name="ignore-failed-store" as="xs:boolean" select="false()"/>
<p:option name="parameters" as="map(xs:QName,item()*)?"/>
<p:option name="static-parameters" as="map(xs:QName,item()*)?"/>
<p:option name="global-context-item" as="item()?"/>
<p:option name="populate-default-collection" as="xs:boolean?" select="true()"/>
<p:option name="initial-mode" as="xs:QName?"/>
<p:option name="template-name" as="xs:QName?"/>
<p:option name="output-base-uri" as="xs:anyURI?"/>
<p:option name="version" as="xs:string?"/>
<p:xslt name="xslt">
<p:with-input port="source" pipe="source@main"/>
<p:with-input port="stylesheet" pipe="stylesheet@main"/>
<p:with-option name="parameters" select="$parameters"/>
<p:with-option name="static-parameters" select="$static-parameters"/>
<p:with-option name="global-context-item" select="$global-context-item"/>
<p:with-option name="populate-default-collection"
select="$populate-default-collection"/>
<p:with-option name="initial-mode" select="$initial-mode"/>
<p:with-option name="template-name" select="$template-name"/>
<p:with-option name="output-base-uri" select="$output-base-uri"/>
<p:with-option name="version" select="$version"/>
</p:xslt>
<p:for-each>
<p:with-input pipe="result@xslt secondary@xslt"/>
<p:choose>
<p:when test="$ignore-failed-store">
<p:try>
<p:store href="{base-uri(/)}"/>
<p:message select="Stored {base-uri(/)}" test="{$show-stored-uris}"/>
<p:catch>
<p:message select="{'Failed to store XSLT output: '
|| p:document-property(., 'content-type')
|| ' ' || base-uri(/)}"/>
</p:catch>
</p:try>
</p:when>
<p:otherwise>
<p:store href="{base-uri(/)}"/>
<p:message select="Stored {base-uri(/)}" test="{$show-stored-uris}"/>
</p:otherwise>
</p:choose>
</p:for-each>
</p:declare-step>
If the $show-stored-uris option is true(), a
p:message will print the URI of each document that is
successfully stored.
If the $ignore-failed-store option is true(),
errors that occur when trying to store the documents do not cause the
pipeline to fail. An error message will be printed.