p:store (3.1) 
Stores a document.
<p:declare-step type="p:store"> <input port="source" primary="true" content-types="any" sequence="false"/> <output port="result" primary="true" content-types="any" sequence="false"/> <output port="result-uri" primary="false" content-types="application/xml" sequence="false"/> <option name="href" as="xs:anyURI" required="true"/> <option name="serialization" as="map(xs:QName, item()*)?" required="false" select="()"/> </p:declare-step>
The p:store step stores the document appearing on its source port to a URI. This document is passed unchanged to the
result port. It outputs the absolute URI of the location of the stored document on the result-uri port.
Ports:
Port | Type | Primary? | Content types | Seq? | Description |
|---|---|---|---|---|---|
|
|
|
|
| The document to store. |
|
|
|
|
| The resulting document. This will be exactly the same as the document on the |
|
|
|
|
| An XML document consisting of just a single Example: |
Options:
The p:store step stores the document appearing on its source port to a URI. This document is passed unchanged to the
result port. So within the pipeline the step acts as a p:identity step.
It outputs the absolute URI of the location of the stored document on the result-uri port.
Whatever input document is passed to the following pipeline, it is stored to disk in a document tmp/x.xml, relative to where
the pipeline is stored. The final p:identity step is just used to show you the document appearing on the
result-uri port.
Pipeline document:
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
<p:input port="source"/>
<p:output port="result"/>
<p:store href="tmp/x.xml"/>
<p:identity>
<p:with-input pipe="result-uri"/>
</p:identity>
</p:declare-step>Result document:
<c:result xmlns:c="http://www.w3.org/ns/xproc-step">file:/…/…/x.xml</c:result>
Doing something with what appears on the result-uri port is of course completely optional. If you don’t attach anything
to this port, the <c:result> document will simply disappear into oblivion.
When developing a pipeline, you often want to take a look at what exactly is flowing through it at a certain stage. Inserting a (temporary)
p:store step is the most easy way to quickly write some intermediate result to a temporary file on disk for inspection. Since p:store acts like
a p:identity step. nothing happens to the flow in your pipeline.
… <p:store href="file:///my/debug/files/location/stepx.xml"/> …
Sometimes you want to keep these temporary storage steps after development. You never know what bugs will pop up and you might need them again! XProc has static options that you can use for this:
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
<p:option static="true" name="write-debug-documents" select="true()"/> … <p:store use-when="{$write-debug-documents}"
href="file:///my/debug/files/location/stepx.xml"/> … </p:declare-step>For the production version you set the write-debug-documents static option to false(). This makes the p:store
disappear from the processed code, as if it was never there…
p:store preserves all document-properties of the document(s) appearing on its source port.
Error code | Description |
|---|---|
It is a dynamic error the file or directory cannot be copied to the specified location. |
This description of the p:store step is for XProc version: 3.1. This is a required step (an XProc 3.1 processor must support this).
The formal specification for the p:store step can be found here.
The p:store step is part of categories:
The p:store step is also present in version:
3.0.