W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > April 2007

Proposed standard component: p:tee

From: Norman Walsh <ndw@nwalsh.com>
Date: Tue, 24 Apr 2007 11:14:04 -0400
To: public-xml-processing-model-wg@w3.org
Message-ID: <871wi9u7nn.fsf@nwalsh.com>
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:50 GMT