Conditionals

With inputs, outputs, and sub-pipelines out of the way, we come,
somewhat indirectly, to conditionals. Despite all the complex drawings
that we had on the board at the f2f, I think a conditional (at least
one where the condition can be evaluated before execution of the
pipeline begins) is fairly simple conceptually.

Let's say we have a p:choose element. If we say that all the branches
of the choice must have the same number of inputs and outputs then
I think it's not too difficult to understand:

  <p:choose>
    <p:input name="schemas" label="s"/>
    <p:input name="document" label="d"/>
    <p:output label="ok"/>

    <p:when test="$status = 'draft'">
      <p:step name="devnull">
        <p:input use="s"/>
      </p:step>
      <p:step name="identity">
        <p:input name="document" use="d"/>
        <p:output/>
      </p:step>
    </p:when>
    <p:when test="$status = 'final'">
      <p:call-pipeline name="expandandvalidate">
        <p:input name="schemas" use="s"/>
        <p:input name="document" use="d"/>
        <p:output/>
      </p:call-pipeline>
    </p:when>
    <p:otherwise>
      <p:error>
        <p:input use="s"/>
        <p:input use="d"/>
        <p:output/>
        <p:message>What the heck did you set $status to exactly?</p:message>
      </p:error>
    </p:otherwise>
  </p:choose>

Like a sub-pipeline, a p:choose defines its inputs and outputs, that
way it fits into the pipeline irrespective of what branch is selected.

I haven't got my head around how to define tests that are evaluated at
runtime based on currently active inputs and outputs.

                                        Be seeing you,
                                          norm

-- 
Norman.Walsh@Sun.COM / XML Standards Architect / Sun Microsystems, Inc.
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

Received on Wednesday, 15 March 2006 14:57:07 UTC