- From: Christopher Ball <christopher.r.ball@gmail.com>
- Date: Wed, 6 Oct 2010 11:01:57 -0400
- To: <vojtech.toman@emc.com>, <xproc-dev@w3.org>
Vojtech, Though it was not my question, I am most grateful for your explanation of "intent". =) -----Original Message----- From: xproc-dev-request@w3.org [mailto:xproc-dev-request@w3.org] On Behalf Of vojtech.toman@emc.com Sent: Wednesday, October 06, 2010 8:12 AM To: xproc-dev@w3.org Subject: RE: choose with no default The "Otherwise, nothing need be done" part still needs to be provided in the pipeline - even if it really does "nothing". In your case, you will have to add a p:otherwise branch to p:choose that might look something like this: <p:otherwise> <!-- do "nothing" with the source document --> <p:identity> <p:input port="source"> <p:pipe port="result" step="text-fix"/> </p:input> </p:identity> </p:otherwise> There is no equivalent of XSLT's xsl:if in XProc that would do some processing only if a certain condition is true. I agree that having something like that in XProc would be nice and would definitely save a lot of typing, but I am afraid that the original XSLT construct wouldn't translate to XProc very well. There is a fundamental difference between XSLT and XProc: In XSLT you use constructs such as xsl:if and xsl:apply-templates to write to the result tree, whereas in XProc, you are not writing anywhere; you are connecting steps. And when connecting steps, you need to know where do the input ports of the steps read the data from (output ports of other steps, external or inline documents etc.). With something like p:if, the steps connected to it would not know where to read the input data from if the IF condition evaluated to false (because the p:if step would not have been executed at all). And unless the p:if step was modeled fundamentally different from other built-in XProc steps (p:choose, p:for-each, p:group, ...), the XProc processor would have no clue as to what to substitute for the result of the not-executed p:if step. So you would have to provide some sort of default anyway - which is what p:choose/p:when/p:otherwise does already. Hope this helps (and that at least some of those English unreal conditionals were grammatically correct :). Vojtech -- Vojtech Toman Consultant Software Engineer EMC | Information Intelligence Group vojtech.toman@emc.com http://developer.emc.com/xmltech
Received on Wednesday, 6 October 2010 15:06:44 UTC