Re: Proposal for changing choose/when/otherwise

Norman Walsh wrote:
> / Jeni Tennison <> was heard to say:
> | I'm very much in favour of making the syntaxes of
> | p:choose/p:when/p:otherwise, p:for-each and p:viewport consistent with
> | each other. But, as I've argued before [1], I think that this should
> | be done by changing p:for-each and p:viewport so that the
> | (((step,source)|href),select) attributes appear on those elements,
> That's the other way of doing it.
> | rather than a separate <p:input>. A <p:input> is still needed to
> | specify the name of the source that's visible to the steps within the
> | <p:for-each> or <p:viewport>.
> The fact that you need *both* the p:input and the attributes on the
> main element (or some other attribute to name the port) is one of the
> reasons I prefer to normalize in the other direction. 

Actually, I view this as a benefit: in all other cases, if you have:

   <p:input port="foo" href="foo.xml" select="/foos/foo" />

then the 'foo' input will be a sequence of documents with <foo> document 
elements. In the case of <p:for-each> and <p:viewport>, the 'foo' input 
will be bound to a *single* document with a <foo> document element. 
(There's a similar discrepancy on the output side which is harder to fix.)

> The other reason
> is because moving the attributes up makes it impossible to use "here"
> documents as input. Granted, it's not necessary or even obviously
> useful, but it seems odd to hamper constructs in this way.

A choice or a viewport on a 'here' document is pretty pointless. I can 
see reasons for doing it with a for-each, but those use cases are easy 
enough to achieve in other ways.

> | Conversely, giving <p:when> a <p:input> that specifies the context of
> | the test on the <p:when> seems really confusing to me. It also leads
> | one to think that there is a new source visible within the contained
> | steps of the <p:when>/<p:otherwise>, but I don't think that's meant to
> | be the case.
> The p:when case is certainly the clumsiest part of doing it the way I
> proposed. And I think it probably does make a new input visible inside
> the p:when, but since we've agreed that *all* of the outputs that are
> in scope can be referenced from inside the p:when, I don't think this
> makes any difference.

I don't think it makes any difference in terms of what the 
implementation has to do, but it seems strange that there are now two 
outputs referring to the same document (sequence).


Jeni Tennison

Received on Wednesday, 25 October 2006 08:48:04 UTC