Proposed standard component: p:tee

The p:tee component accepts a single document and copies it to its
output. It also stores a copy of it in the specified URI:

<p:declare-step type="p:tee">
  <p:input port="source" sequence="no"/>
  <p:output port="result" sequence="no"/>
  <p:option name="href" required="yes"/>
</p:declare-step>

This isn't strictly necessary as it can be achieved with a p:store
component. However, if you use a p:store, then you have to change
other parts of the pipeline.

Consider:

...
<p:xinclude/>

<p:xslt2>
  <p:input port="stylesheet">
    <p:document href="/projects/w3c/WWW/XML/XProc/style/dbspec.xsl"/>
  </p:input>
</p:xslt2>
...

If you want to save a copy of the XInclude output, you could introduce
a store:

...
<p:xinclude/>

<p:store>
  <p:option name="href" value="/tmp/lsxi.xml"/>
</p:store>

<p:xslt2>
  <p:input port="stylesheet">
    <p:document href="/projects/w3c/WWW/XML/XProc/style/dbspec.xsl"/>
  </p:input>
</p:xslt2>
...

But introducing the p:store interferes with the defaulting for the
p:xslt2 step, so you also have to change it. And in order to change it,
you have to change the preceding p:xinclude too:

...
<p:xinclude name="xinc"/>

<p:store>
  <p:option name="href" value="/tmp/lsxi.xml"/>
</p:store>

<p:xslt2>
  <p:input port="source">
    <p:pipe step="xinc" port="result"/>
  </p:input>
  <p:input port="stylesheet">
    <p:document href="/projects/w3c/WWW/XML/XProc/style/dbspec.xsl"/>
  </p:input>
</p:xslt2>
...

A p:tee could simply be added (or removed) without any inpact on
the rest of the pipeline. And clearly it's a useful debugging tool.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | There is much pleasure to be gained
http://nwalsh.com/            | from useless knowledge.--Bertrand
                              | Russell

Received on Tuesday, 24 April 2007 15:14:26 UTC