W3C home > Mailing lists > Public > xproc-dev@w3.org > March 2012

RE: why the output requirements on viewport?

From: <vojtech.toman@emc.com>
Date: Tue, 13 Mar 2012 06:12:47 -0400
To: <xproc-dev@w3.org>
Message-ID: <3799D0FD120AD940B731A37E36DAF3FE341E11B3D5@MX20A.corp.emc.com>

Hi Conal,

Note that p:viewport is defined as:

"The result of the p:viewport is a copy of the original document where the selected subtrees have been replaced by the results of applying the subpipeline to them."

So p:viewport always produces a modified version of the input document; it is actually the whole point of p:viewport.

If you are just concerned about the sub-pipelines but not about the p:viewport's result, I think you can always use a p:for-each loop.

But if your main complaint is about the error XS0006 that you get when the sub-pipeline does not have a primary output port and p:viewport's "inner" output port is not connected then yes - maybe we have made that too strict. Although it is consistent with what happens in p:for-each and with the general rules regarding the output ports of compound steps and their sub-pipelines.

Because of the above, to achieve the "viewport could simply remove the matched elements" functionality that you want, you have to do something like this:

<p:viewport match="...">
  <p:output port="foo"><p:empty/></p:output>
  ... sub-pipeline without a primary output port ...
</p:viewport>

Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

From: Conal Tuohy [mailto:conal.tuohy@gmail.com] On Behalf Of Conal Tuohy
Sent: Tuesday, March 13, 2012 5:14 AM
To: XProc Dev
Subject: why the output requirements on viewport?

Why does the XProc spec require viewports to have a primary output? http://www.w3.org/TR/xproc/#err.S0006


The p:viewport must contain a single, primary output port<http://www.w3.org/TR/xproc/#dt-primary-output-port> declared explicitly or supplied by default<http://www.w3.org/TR/xproc/#primary-input-output>. If that port has no connection<http://www.w3.org/TR/xproc/#dt-connection>, then it is connected to the primary output port<http://www.w3.org/TR/xproc/#dt-primary-output-port> of the last step<http://www.w3.org/TR/xproc/#dt-last-step> in the subpipeline<http://www.w3.org/TR/xproc/#dt-subpipeline>. It is a static error<http://www.w3.org/TR/xproc/#dt-static-error> (err:XS0006<http://www.w3.org/TR/xproc/#err.S0006>) if the primary output port is unconnected and the last step<http://www.w3.org/TR/xproc/#dt-last-step> in the subpipeline does not have a primary output port.
http://www.w3.org/TR/xproc/#p.viewport

I can see that it is generally useful to provide an output (when using the viewport as a way of transforming a document by transforming chunks of it) but equally it's sometimes unnecessary (when using the viewport merely to break the document into chunks for independent processing in their own right). It seems to me that in those cases where a viewport's sub-pipeline merely consumes the sequence of documents without producing any output, the viewport could simply remove the matched elements (i.e. it would behave like p:delete, seen from the outside).
--


Conal Tuohy

eResearch Business Analyst

Victorian eResearch Strategic Initiative

+61-466324297
Received on Tuesday, 13 March 2012 10:13:37 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 13 March 2012 10:13:37 GMT