p:choose

I suppose the consistent design for p:choose is:

<p:choose name="pickone">
  <p:declare-input port="input" ref="#some/input"/>
  <p:declare-output port="result"/>
  <p:declare-output port="error"/>

  <p:when test="/fo:root">
    <p:step kind="identity">
      <p:input port="input" ref="#pickone/input"/>
      <p:output port="result" ref="#pickone/result"/>
    </p:step>
    <p:step kind="empty">
      <p:output port="result" ref="#pickone/error"/>
    </p:step>
  </p:when>
  <p:otherwise>
    <p:step kind="empty">
      <p:output port="result" ref="#pickone/result"/>
    </p:step>
    <p:step kind="identity">
      <p:input port="input">
        <p>Root must be fo:root!</p>
      </p:input>
      <p:output port="result" ref="#pickone/error"/>
    </p:step>
  </p:otherwise>
</p:choose>

Here the user declares exactly one input as the input for the tests
and all the outputs that are needed.

Whether we allow "dangling outputs" to be automatically made empty or
if we require them to to be explicitly connected is an open question.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
XML Standards Architect
Sun Microsystems, Inc.

Received on Thursday, 27 July 2006 14:50:52 UTC