Syntax noodling

Imagine that the following configuration is known to the engine:

<p:pipelineConfig xmlns:p="http://xproc.org/ns/p">

<p:component name="p:pipeline"/>

<p:component name="p:load">
  <p:input name="stdin"/>
  <p:output name="stdout"/>
</p:component>

<p:component name="p:save">
  <p:param name="href"/>
  <p:input name="stdin"/>
</p:component>

<p:component name="p:xslt10">
  <p:input name="stdin"/>
  <p:input name="style"/>
  <p:output name="stdout"/>
</p:component>

</p:pipelineConfig>

Then we can consider several possible syntaxes for a simple load/style/save
pipeline:

EXPLICIT-NAMES-EXPLICIT-STEPS

<?xml version="1.0"?>
<p:pipeline xmlns:p="http://xproc.org/ns/p">

<p:step name="p:load">
  <p:input name="stdin" href="style.xsl"/>
  <p:output name="stdout" label="style"/>
</p:step>

<p:step name="p:load">
  <p:input name="stdin" href="document.xml"/>
  <p:output name="stdout" label="doc"/>
</p:step>

<p:step name="p:xslt10">
  <p:input name="stdin" ref="doc"/>
  <p:input name="style" ref="style"/>
  <p:output name="stdout" label="styled"/>
</p:step>

<p:step name="p:save">
  <p:param name="href" value="output.html"/>
  <p:input name="stdin" ref="styled"/>
</p:step>

</p:pipeline>

Or

IMPLICIT-NAMES-EXPLICIT-STEPS

<?xml version="1.0"?>
<p:pipeline xmlns:p="http://xproc.org/ns/p">

<p:step name="p:load" xml:id="load-style">
  <p:input name="stdin" href="style.xsl"/>
</p:step>

<p:step name="p:load" xml:id="load-doc">
  <p:input name="stdin" href="document.xml"/>
</p:step>

<p:step name="p:xslt10" xml:id="style">
  <p:input name="stdin" ref="#load-doc/stdout"/>
  <p:input name="style" ref="#load-style/stdout"/>
</p:step>

<p:step name="p:save">
  <p:param name="href" value="output.html"/>
  <p:input name="stdin" ref="#style/stdout"/>
</p:step>

</p:pipeline>

Or

IMPLICIT-NAMES-IMPLICIT-STEPS

<?xml version="1.0"?>
<p:pipeline xmlns:p="http://xproc.org/ns/p">

<p:load xml:id="load-style">
  <p:input name="stdin" href="style.xsl"/>
</p:load>

<p:load xml:id="load-doc">
  <p:input name="stdin" href="document.xml"/>
</p:load>

<p:xslt10 xml:id="style">
  <p:input name="stdin" ref="#load-doc/stdout"/>
  <p:input name="style" ref="#load-style/stdout"/>
</p:xslt10>

<p:save>
  <p:param name="href" value="output.html"/>
  <p:input name="stdin" ref="#style/stdout"/>
</p:save>

</p:pipeline>

Or

IMPLICT-NAMES-IMPLICIT-STEPS-IMPLICIT-IO

<?xml version="1.0"?>
<p:pipeline xmlns:p="http://xproc.org/ns/p">

<p:load xml:id="load-style">
  <p:stdin href="style.xsl"/>
</p:load>

<p:load xml:id="load-doc">
  <p:stdin href="document.xml"/>
</p:load>

<p:xslt10 xml:id="style">
  <p:stdin ref="#load-doc/stdout"/>
  <p:style ref="#load-style/stdout"/>
</p:xslt10>

<p:save>
  <p:param name="href" value="output.html"/>
  <p:stdin ref="#style/stdout"/>
</p:save>

</p:pipeline>

And I can imagine a few other combinations (explicit names/implicit I/O,
for example).

On the whole, I favor the more explicit options, but maybe there's
something to be said for implicit names. Implicit steps and implicit
I/O require less typing but they require the reader to know even more
to make sense of the pipeline.

                                        Be seeing you,
                                          norm

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

Received on Friday, 5 May 2006 13:47:15 UTC