Re: p:choose

Norm,

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? Should
we also allow an 'href' here, to be consistent with the
<p:with-input>?

> 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.

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>

Alex
-- 
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/

Received on Thursday, 20 July 2006 06:54:06 UTC