Re: Inputs and outputs

/ Alex Milowski <alex@milowski.org> was heard to say:
| Norman Walsh wrote:
|> With that in mind, we could do it like this:
|>
|>   <p:pipeline>
|>     <!-- accept a document, a schema, and a stylesheet. -->
|>     <!-- validate, transform, and return the result -->
|>     <p:declare-input-port port="document" name="xmlfile"/>
|>     <p:declare-input-port port="schema" name="xsdfile"/>
|>     <p:declare-input-port port="stylesheet" name="xslfile"/>
|>     <p:declare-output-port port="result" name="output"/>
|>
|>     <p:step kind="validate">
|>       <p:input port="document" from="xmlfile"/>
|>       <p:input port="schema" from="xsdfile"/>
|>       <p:output port="result" name="validxml"/>
|>     </p:step>
|>
|>     <p:step kind="xslt">
|>       <p:input port="document" from="validxml"/>
|>       <p:input port="stylesheet" from="xslfile"/>
|>       <p:output port="result" to="output"/>
|>     </p:step>
|>   <p:pipeline>
|
| OK.  I'm quite happy with this.
|
|> Or we could say:
|>
|>   <p:pipeline>
|>     <!-- accept a document, a schema, and a stylesheet. -->
|>     <!-- validate, transform, and return the result -->
|>     <p:declare-input-port port="document" name="xmlfile"/>
|>     <p:declare-input-port port="schema" name="xsdfile"/>
|>     <p:declare-input-port port="stylesheet" name="xslfile"/>
|>     <p:declare-output-port port="result" name="output"/>
|>
|>     <p:step kind="validate">
|>       <p:input port="document" from="xmlfile"/>
|>       <p:input port="schema" from="xsdfile"/>
|>       <p:output port="result" to="styler"/>
|>     </p:step>
|
| I'm confused by the 'to' value of 'styler' above.  That isn't defined
| in this pipeline example.

Indeed, I meant to add:

|>     <p:step kind="xslt">
|>       <p:input port="document"/>

                                  name="styler"

to the input port on the XSLT process.

|>       <p:input port="stylesheet" from="xslfile"/>
|>       <p:output port="result" to="output"/>
|>     </p:step>
|>   <p:pipeline>
|
|> Or we could do the naming "Richard's way":
|>
|>   <p:pipeline name="pipe">
|>     <!-- accept a document, a schema, and a stylesheet. -->
|>     <!-- validate, transform, and return the result -->
|>     <p:declare-input-port port="document"/>
|>     <p:declare-input-port port="schema"/>
|>     <p:declare-input-port port="stylesheet"/>
|>     <p:declare-output-port port="result"/>
|>
|>     <p:step kind="validate" name="validate">
|>       <p:input port="document" from="pipe.document"/>
|>       <p:input port="schema" from="pipe.schema"/>
|>       <p:output port="result"/>
|>     </p:step>
|>
|>     <p:step kind="xslt" name="transform">
|>       <p:input port="document" from="validate.result"/>
|>       <p:input port="stylesheet" from="pipe.stylesheet"/>
|>       <p:output port="result" to="pipe.result"/>
|>     </p:step>
|>   <p:pipeline>
|
| If we were to do this, we'd need to use something other than
| the "." for syntax.  Personally, I'm not really moved by
| this idea.

I agree about the ".", I was just trying to avoid making up new stuff
where I didn't have to. I'm about 60/40 in favor of this approach
though.

|>     <p:choose>
|>       <p:declare-input-port port="testdocument" from="validxml"/>
|>       <p:declare-output-port port="result" name="xformed"/>
|
| That would be a nice shortcut.
|
|>
|> Anyway, the important bits are:
|>
|>  1. Inside the p:choose, the only input ports available are the ones
|>     locally declared. This makes p:choose a wholly self-contained
|>     element which I really like.
|>
|>  2. If there's any p:when that does not have a binding to all of the
|>     declared output-ports, that's a static error.
|
| Or that output is just not produced.  We do have a choice there.  It
| would be a static error if the output of the pipeline could not
| be produced.  Having a choice where the output is option might be
| nice.

Well, in the interest of full specification right now, I think I'd
prefer an explicit binding of "/dev/null" to the output if you didn't
want any.

| The problem there would be that in some situations, a choice with
| 'when' clauses with no output would be allowed, but in others--where
| the output is traceable to the output of the pipeline, it would not.
| That might drive users insane.

Exactly.

|> Also, while I'm not a huge fan of the name "port", by using it I have
|> been able to reserve the attribute "name" exclusively for names that
|> authors invent in order to point at them which I think will make
|> Murray and Alex happy.
|
| Yes.  This makes me happy. :)

                                        Be seeing you,
                                          norm

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

Received on Thursday, 20 July 2006 20:53:27 UTC