- From: Norman Walsh <Norman.Walsh@Sun.COM>
- Date: Thu, 20 Jul 2006 10:41:57 -0400
- To: public-xml-processing-model-wg@w3.org
- Message-ID: <87wta82v9m.fsf@nwalsh.com>
/ Alessandro Vernet <avernet@orbeon.com> was heard to say:
| On 7/19/06, Norman Walsh <Norman.Walsh@sun.com> wrote:
|> A choose looks like:
|>
|> choose := ($over?, when+, otherwise?)
|
| Any reason we wouldn't reuse the 'from' attribute we have on the
| <p:with-input> instead of introducing a new 'over' attribute?
I took "over" from someone's proposal, if not yours, perhaps Alex's.
I would be content to use "from" here, I think.
| Should
| we also allow an 'href' here, to be consistent with the
| <p:with-input>?
No, choose isn't an input. You can load a URI and then refer to it
if that's what you really want:
<p:step name="load">
<p:with-output name="result" label="mydoc"/>
<p:param name="href" select="someURI"/>
<p:step>
<p:choose from="mydoc">
...
</p:choose>
|> This clearly won't work at run time, but is there any way we can
|> constrain the syntax of the choose elements so that this is
|> manifest at "compile time"?
|
| In XPL as we have initially implemented it (and how it is still
| implemented and used today), there is no <p:output> in <p:choose>, as
| in your proposed syntax. The labels (to use our current terminology)
| exposed to the outside by the <p:choose> are determined automatically
| by the engine.
How can that be? How does a step express that it wants to consume the
output of the p:choose?
| In the XPL implementation, the engine determines for each <p:when> or
| <p:otherwise> what the set of exposed labels is. It does this by
| taking for each <p:when> or <p:otherwise> all the labels that are
| declared, but not used. Then it checks that each <p:when> or
| <p:otherwise> declared the exact same set of labels. This test can be
| performed statically, which IMHO is a good thing, but this method has
| some downsides.
|
| Because of those downsides, in our XPL submission
| (http://www.w3.org/Submission/xpl/), we have introduced an element to
| declare the output of a <p:choose>. I still think this is a good idea:
| it allows static checking and avoids some strange cases that come up
| when using the above algorithm. A <p:choose> would look like:
|
| <p:choose>
| <p:choose-output label="..." from="..."/>
| 'label' is the label exposed to the outside of the <p:choose>
| 'from' is a reference to a label that must be declared by each
| branch of the <p:choose>
| ...
| </p:choose>
Yes, maybe that's all that's needed. The p:choose declares what it's
output is. Each branch can use any inputs that are currently available
and must declare an output with the right label.
<p:choose>
<p:output name="result" from="output" label="choose-output"/>
<p:when test="...">
<p:step>
<p:with-output name="result" label="output"/>
...
</p:step>
</p:when>
<p:when test="...">
<p:step>
<p:with-output name="result" label="output"/>
...
</p:step>
</p:when>
</p:choose>
<p:step>
<p:with-input name="somename" from="choose-output"/>
...
</p:step>
Of course, this introduces the odd wrinkle that a p:output inside a
choose requires both a 'from' and a 'label'.
I'm not convinced we've got a consistent story about how the pointing
works.
Examples like this make me think that using "name/stream" labels make
more sense:
<p:choose name="mychoose">
<p:output name="result" from="#branch/result"/>
<p:when test="...">
<p:step name="branch">
<p:with-output name="result"/>
...
</p:step>
</p:when>
<p:when test="...">
<p:step name="branch">
<p:with-output name="result"/>
...
</p:step>
</p:when>
</p:choose>
<p:step>
<p:with-input name="somename" from="#mychoose/result"/>
...
</p:step>
I dunno.
Be seeing you,
norm
--
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.
Received on Thursday, 20 July 2006 14:42:25 UTC