Re: Examples of pipelines, various

So, with this direct syntax on steps, what happens when I have a 
pipeline library defining a pipeline "my-pipe" and want to use it inside 
another pipeline? Currently, we could do it with something like

<p:step type="my-pipe">...</p:step>

IMHO, with the direct syntax there is no way to do it. Maybe we need a 
<p:call-pipeline /> ? Or am I missing something?


Cheers,
Rui


Henry S. Thompson wrote:
> I attach a new / alternative DTD, and examples, using the
> non-chameleon approach (aka Tiger).  These can/should be contrasted
> with those sent two weeks ago:
> 
>   http://lists.w3.org/Archives/Public/public-xml-processing-model-wg/2007Feb/0014.html
> 
> ht
> 
> 
> 
> ------------------------------------------------------------------------
> 
> <!ENTITY % p 'p:'> <!-- can be overriden in the internal subset of a
>                          schema document to establish a different
>                          namespace prefix -->
> <!ENTITY % s ':p'> <!-- if %p is defined (e.g. as foo:) then you must
>                          also define %s as the suffix for the appropriate
>                          namespace declaration (e.g. :foo) -->
> <!ENTITY % nds 'xmlns%s;'>
> 
> <!ENTITY % pipeline "%p;pipeline">
> <!ENTITY % input "%p;input">
> <!ENTITY % document "%p;document">
> <!ENTITY % pipe "%p;pipe">
> <!ENTITY % inline "%p;inline">
> <!ENTITY % output "%p;output">
> <!ENTITY % parameter "%p;parameter">
> <!ENTITY % import-parameter "%p;import-parameter">
> <!ENTITY % for-each "%p;for-each">
> <!ENTITY % viewport "%p;viewport">
> <!ENTITY % choose "%p;choose">
> <!ENTITY % when "%p;when">
> <!ENTITY % otherwise "%p;otherwise">
> <!ENTITY % xpath-context "%p;xpath-context">
> <!ENTITY % iteration-source "%p;iteration-source">
> <!ENTITY % group "%p;group">
> <!ENTITY % try "%p;try">
> <!ENTITY % catch "%p;catch">
> <!ENTITY % declare-step-type "%p;declare-step-type">
> <!ENTITY % pipeline-library "%p;pipeline-library">
> <!ENTITY % import "%p;import">
> 
> <!ENTITY % user-defined-step "">
> <!ENTITY % primary-step "%p;xslt|%p;validate|%p;xinclude|%p;identity">
> <!ENTITY % minor-step "%p;rename|%p;wrap|%p;insert">
> 
> <!ENTITY % step "(%primary-step; | %minor-step; %user-defined-step;)">
> 
> <!ENTITY % subpipeline
>  "(%step;|%group;|%viewport;|%for-each;|%choose;|%try;)*">
> <!ENTITY % binding
>  "(%document;|%pipe;|%inline;)">
> 
> <!ENTITY % NCName "NMTOKEN">
> <!ENTITY % QName "NMTOKEN">
> <!ENTITY % URIref "CDATA">
> <!ENTITY % XPath_expression "CDATA">
> <!ENTITY % expression "CDATA">
> <!ENTITY % port_name "NMTOKEN">
> <!ENTITY % step_name "NMTOKEN">
> <!ENTITY % string "CDATA">
> <!ENTITY % token "NMTOKEN">
> 
> <!ELEMENT %pipeline; 
>    ((%input;)*,
>     (%output;)*,
>     (%parameter;)*,
>     (%import;)*,
>     (%declare-step-type;)*,
>     %subpipeline;)>
> <!ATTLIST %pipeline; 
>           name %NCName; #IMPLIED
>           %nds; %URIref; #FIXED 'http://www.w3.org/2006/11/pipeline'
>  >
> <!ELEMENT %input; (%binding;)?>
> <!ATTLIST %input;  
>   port %NCName; #REQUIRED
>   sequence (yes|no)  'no'
>   select %XPath_expression;  #IMPLIED>
> 
> <!ELEMENT %pipe; EMPTY>
> <!ATTLIST %pipe;
>   step %step_name; #REQUIRED
>   port %port_name; #REQUIRED>
> 
> <!ELEMENT %document; EMPTY>
> <!ATTLIST %document;  href %URIref; #REQUIRED>
> 
> <!ELEMENT %inline; ANY>
> 
> <!ELEMENT %iteration-source; (%binding;)?>
> <!ATTLIST %iteration-source;  
>   select %XPath_expression;  #IMPLIED>
> 
> <!ELEMENT %output; 
>    (%binding;)?>
> <!ATTLIST %output;  
>   port %NCName; #REQUIRED
>   sequence (yes|no)  'no'
>   default (yes|no) 'no'>
> 
> <!ELEMENT %parameter; ANY>
> <!ATTLIST %parameter;  
>   name %token; #REQUIRED
>   required (yes|no) 'no'
>   value %string; #REQUIRED
>   select %XPath_expression;  #IMPLIED
>   step %step_name; #IMPLIED
>   source %port_name; #IMPLIED
>   href %URIref; #IMPLIED
>  >
> 
> <!ENTITY % step-model
>    "((%input;)*,
>      (%import-parameter;)*,
>      (%parameter;)*)">
> 
> <!ENTITY % step-attrs
>   "name %NCName; #REQUIRED"
>  >
> 
> <!ENTITY % xslt "%p;xslt">
> <!ELEMENT %xslt; %step-model;>
> <!ATTLIST %xslt; %step-attrs;>
> 
> <!ENTITY % validate "%p;validate">
> <!ELEMENT %validate; %step-model;>
> <!ATTLIST %validate; %step-attrs;>
> 
> <!ENTITY % xinclude "%p;xinclude">
> <!ELEMENT %xinclude; %step-model;>
> <!ATTLIST %xinclude; %step-attrs;>
> 
> <!ENTITY % identity "%p;identity">
> <!ELEMENT %identity; %step-model;>
> <!ATTLIST %identity; %step-attrs;>
> 
> <!ENTITY % rename "%p;rename">
> <!ELEMENT %rename; %step-model;>
> <!ATTLIST %rename; %step-attrs;>
> 
> <!ENTITY % wrap "%p;wrap">
> <!ELEMENT %wrap; %step-model;>
> <!ATTLIST %wrap; %step-attrs;>
> 
> <!ENTITY % insert "%p;insert">
> <!ELEMENT %insert; %step-model;>
> <!ATTLIST %insert; %step-attrs;>
> 
> <!ELEMENT %import-parameter; EMPTY>
> <!ATTLIST %import-parameter;  
>   name %token; #REQUIRED
>  >
> <!ELEMENT %for-each; 
>    (%iteration-source;,
>     (%input;)*,
>     (%output;)*,
>     (%parameter;)*,
>     %subpipeline;)>
> <!ATTLIST %for-each; 
>   name %NCName; #REQUIRED
>  >
> <!ELEMENT %viewport; 
>    (%iteration-source;,
>     (%input;)*,
>     %output;,
>     (%parameter;)*,
>     %subpipeline;)>
> <!ATTLIST %viewport; 
>   name %NCName; #REQUIRED
>  >
> <!ELEMENT %choose; 
>    ((%xpath-context;)?,
>     (%when;)*,
>     (%otherwise;)?)>
> <!ATTLIST %choose; 
>   name %NCName; #REQUIRED
>  >
> <!ELEMENT %when; 
>    ((%xpath-context;)?,
>     (%output;)*,
>     (%parameter;)*,
>     %subpipeline;)>
> <!ATTLIST %when; 
>   test %expression; #REQUIRED
>  >
> <!ELEMENT %otherwise; 
>    ((%output;)*,
>     (%parameter;)*,
>     %subpipeline;)>
> <!ELEMENT %xpath-context;
>    %binding;>
> <!ELEMENT %group; 
>    ((%output;)*,
>     (%parameter;)*,
>     %subpipeline;)>
> <!ATTLIST %group; 
>   name %NCName; #REQUIRED
>  >
> <!ELEMENT %try; 
>    (%group;,
>     %catch;)>
> <!ATTLIST %try; 
>   name %NCName; #REQUIRED
>  >
> <!ELEMENT %catch; 
>    ((%output;)*,
>     (%parameter;)*,
>     %subpipeline;)>
> <!ELEMENT %declare-step-type; 
>    ((%input;)*,
>     (%output;)*,
>     (%parameter;)*)>
> <!ATTLIST %declare-step-type; 
>           type %QName; #REQUIRED
>  >
> <!ELEMENT %pipeline-library; 
>    ((%import;)*,
>     (%declare-step-type;)*,
>     (%pipeline;)*)>
> <!ATTLIST %pipeline-library;
>           name %NCName; #REQUIRED
>           %nds; %URIref; #FIXED 'http://www.w3.org/2006/11/pipeline'>
> <!ELEMENT %import; EMPTY>
> <!ATTLIST %import;
>   href %URIref; #REQUIRED
>  >
> 
> 
> ------------------------------------------------------------------------
> 
> <!DOCTYPE p:choose SYSTEM "xproc.dtd">
> <p:choose name="version" xmlns:p="http://example.org/PipelineNamespace">
>   <p:xpath-context>
>     <p:pipe step="prevstep" port="result"/>
>   </p:xpath-context>
> 
>   <p:when test="/*[@version = 2]">
>     <p:output port="result">
>       <p:pipe step="v2valid" port="result"/>
>     </p:output>
> 
>     <p:validate name="v2valid">
>       <p:input port="source">
>         <p:pipe step="prevstep" port="result"/>
>       </p:input>
>       <p:input port="schema">
>         <p:document href="v2schema.xsd"/>
>       </p:input>
>     </p:validate>
>   </p:when>
> 
>   <p:when test="/*[@version = 1]">
>     <p:output port="result">
>       <p:pipe step="v1valid" port="result"/>
>     </p:output>
> 
>     <p:validate name="v1-valid">
>       <p:input port="source">
>         <p:pipe step="prevstep" port="result"/>
>       </p:input>
>       <p:input port="schema">
>         <p:document href="v1schema.xsd"/>
>       </p:input>
>     </p:validate>
>   </p:when>
> 
>   <p:otherwise>
>     <p:output port="result">
>       <p:pipe step="ident" port="result"/>
>     </p:output>
> 
>     <p:identity name="ident">
>       <p:input port="source">
>         <p:pipe step="prevstep" port="result"/>
>       </p:input>
>     </p:identity>
>   </p:otherwise>
> </p:choose>
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version='1.0'?>
> <!DOCTYPE p:pipeline SYSTEM "xproc.dtd" >
> <p:pipeline name="fig1" xmlns:p="http://www.w3.org/2006/11/pipeline">
>   <p:input port="doc" sequence="no"/>
>   <p:input port="schemaDoc" sequence="yes"/>
>   <p:output port="out">
>    <p:pipe step="s2" port="result"/>
>   </p:output>
> 
>   <p:xinclude name="s1">
>     <p:input port="document">
>      <p:pipe step="fig1" port="doc"/>
>     </p:input>
>   </p:xinclude>
> 
>   <p:validate name="s2">
>     <p:input port="document">
>      <p:pipe step="s1" port="result"/>
>     </p:input>
>     <p:input port="schema">
>      <p:pipe step="fig1" port="schemaDoc"/>
>     </p:input>
>   </p:validate>
> </p:pipeline>
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version='1.0'?>
> <!DOCTYPE p:pipeline SYSTEM "xproc.dtd" >
> <p:pipeline name="fig2" xmlns:p="http://www.w3.org/2006/11/pipeline">
>   <p:input port="doc" sequence="no"/>
>   <p:output port="out">
>    <p:pipe step="xform" port="result"/>
>   </p:output>
> 
>   <p:choose name="vcheck">
>    <p:xpath-context>
>     <p:pipe step="fig2" port="doc"/>
>    </p:xpath-context>
>    
>     <p:when test="/*[@version &lt; 2.0]">
>       <p:output port="valid">
>        <p:pipe step="val1" port="result"/>
>       </p:output>
> 
>       <p:validate name="val1">
>         <p:input port="document">
>          <p:pipe step="fig2" port="doc"/>
>         </p:input>
>         <p:input port="schema">
>          <p:document href="v1schema.xsd"/>
>         </p:input>
>       </p:validate>
>     </p:when>
> 
>     <p:otherwise>
>       <p:output port="valid">
>        <p:pipe step="val2" port="result"/>
>       </p:output>
> 
>       <p:validate name="val2">
>         <p:input port="document">
>          <p:pipe step="fig2" port="doc"/>
>         </p:input>
>         <p:input port="schema">
>          <p:document href="v1schema.xsd"/>
>         </p:input>
>       </p:validate>
>     </p:otherwise>
>   </p:choose>
> 
>   <p:xslt name="xform">
>     <p:input port="document">
>      <p:pipe step="vcheck" port="valid"/>
>     </p:input>
>     <p:input port="stylesheet">
>      <p:document href="stylesheet.xsl"/>
>     </p:input>
>   </p:xslt>
> </p:pipeline>
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version='1.0'?>
> <!DOCTYPE p:pipeline SYSTEM "xproc.dtd" >
> <p:pipeline name="fig1" xmlns:p="http://www.w3.org/2006/11/pipeline">
>   <p:input port="doc" sequence="no"/>
>   <p:input port="schemaDoc" sequence="yes"/>
> 
>   <p:xinclude name="s1">
>     <p:input port="document">
>      <p:pipe step="fig1" port="doc"/>
>     </p:input>
>   </p:xinclude>
> 
>   <p:validate name="s2">
>     <p:input port="schema">
>      <p:pipe step="fig1" port="schemaDoc"/>
>     </p:input>
>   </p:validate>
> </p:pipeline>
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version='1.0'?>
> <!DOCTYPE p:pipeline SYSTEM "xproc.dtd" >
> <p:pipeline name="fig2" xmlns:p="http://www.w3.org/2006/11/pipeline">
>   <p:input port="doc" sequence="no"/>
> 
>   <p:choose name="vcheck">
>    
>     <p:when test="/*[@version &lt; 2.0]">
>       <p:validate name="val1">
>         <p:input port="schema">
>          <p:document href="v1schema.xsd"/>
>         </p:input>
>       </p:validate>
>     </p:when>
> 
>     <p:otherwise>
>       <p:validate name="val2">
>         <p:input port="schema">
>          <p:document href="v1schema.xsd"/>
>         </p:input>
>       </p:validate>
>     </p:otherwise>
> 
>   </p:choose>
> 
>   <p:xslt name="xform">
>     <p:input port="stylesheet">
>      <p:document href="stylesheet.xsl"/>
>     </p:input>
>   </p:xslt>
> 
> </p:pipeline>
> 

Received on Saturday, 17 February 2007 14:09:57 UTC