- From: Achim Berndzen <achim.berndzen@xml-project.com>
- Date: Fri, 21 Oct 2016 16:36:33 +0200
- To: XProc Dev <xproc-dev@w3.org>
Sorry, obviously I missed this one. The „same signature for all branches“-rule surely is an inconvenience in terms of verbosity. If I remember right, it gave me some troubles when learning XProc, but once I get used to it, it is not hard to follow. Saying the same with less keystrokes, as Norm suggested, surely makes writing pipelines easier, so I would welcome his suggestion. On the other hand I recall the discussions we had about XProc’s high learning curve. Replacing one simple rule with three new rules may add some further complexity to XProc. By the way: Unless I miss something important, the new rules should also state that a output port present in one branch but missing in another must have @sequence=„true“. Right? Cheers, Achim ------------------------------------------------ Achim Berndzen achim.berndzen@xml-project.com http://www.xml-project.com > Am 18.10.2016 um 15:12 schrieb Norman Walsh <ndw@nwalsh.com>: > > Hello world, > > How much of an inconvenience is the requirement that all branches of a > choose/when have the same signature? > > Suppose we eliminated that rule. > > <p:choose name="run-stuff"> > <p:when test="not($moon-is-full) or ($today != $tuesday)"> > <p:output port="result" primary="true"/> > <p:output port="secondary" step="xslt"/> > <p:xslt name="xslt">…</p:xslt> > </p:when> > <p:otherwise> > <p:output port="result"/> > <p:identity> > <p:document href="not-today.xml"/> > </p:identity> > </p:otherwise> > </p:choose> > > Three new rules: > > 1. An explicit binding to an output port on a p:choose is allowed as > long as at least one of its branches defines a port with that name. > That means <p:input step="run-stuff" port="secondary"/> is ok, > but <p:input step="run-stuff" port="fribble"/> is a static error. > > 2. A p:choose has a primary output port if-and-only-if all of the > branches have a primary output port with the same name. So this choose > does have a primary output port: "result". > > 3. Any choose output that is not provided by the branch actually > evaluated at runtime gets an empty sequence. That means that > when the moon is full on Tuesdays, > <p:input step="run-stuff" port="secondary"/> gets an empty sequence. > > We could relax rule 1 further and say any binding is allowed, but > that doesn’t seem like it would be helpful to the author. > > We could relax rule 2 further and say that it has a primary output > port if any of its branches do. But that would have consequences that > seem extra weird to me. The primary output port is a convenience, it > can always be replaced by an explicit binding. But if we relaxed rule > 2 so that any output that was primary in the selected branch was > bound, then that would no longer be true as the primary outputs might > have different port names in the different branches. > > Be seeing you, > norm > > -- > Norman Walsh > Lead Engineer > MarkLogic Corporation > Phone: +1 512 761 6676 > www.marklogic.com
Received on Friday, 21 October 2016 14:37:02 UTC