W3C home > Mailing lists > Public > public-xml-processing-model-wg@w3.org > December 2006

Example 2 revisited with 6 defaulting rules applied

From: Innovimax SARL <innovimax@gmail.com>
Date: Sat, 23 Dec 2006 00:05:26 +0100
Message-ID: <546c6c1c0612221505u9bd474aga8603625b24e66@mail.gmail.com>
To: "XProc WG" <public-xml-processing-model-wg@w3.org>

<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline">
  <p:input port="source" sequence="no"/>
  <p:output port="result">
    <p:pipe step="xform" port="result"/>
  </p:output>

  <p:choose name="vcheck" step="fig2" source="doc"><!-- remove @step
and @source-->
    <!--start added 1-->
    <p:input port="source">
       <p:pipe step="fig2" source="source"/><!-- source is source -->
    </p:input>
    <!--end added 1-->
    <p:when test="/*[@version &lt; 2.0]">
      <p:output port="valid">
        <p:pipe step="val1" port="result"/>
      </p:output>
      <p:step type="p:validate" name="val1">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output port="valid">
        <p:pipe step="val2" port="result"/>
      </p:output>
      <p:step type="p:validate" name="val2">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt" name="xform">
    <p:input port="source">
      <p:pipe step="vcheck" port="valid"/>
    </p:input>
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>

-1) apply primary definition

<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline"
            primary-input="source"
            primary-output="result">
  <p:input port="source" sequence="no"/>
  <p:output port="result">
    <p:pipe step="xform" port="result"/>
  </p:output>

  <p:choose name="vcheck"
            primary-input="source"
            primary-output="valid">
    <p:input port="source">
       <p:pipe step="fig2" source="source"/>
    </p:input>
    <p:when test="/*[@version &lt; 2.0]">
      <p:output port="valid">
        <p:pipe step="val1" port="result"/>
      </p:output>
      <p:step type="p:validate" name="val1">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output port="valid">
        <p:pipe step="val2" port="result"/>
      </p:output>
      <p:step type="p:validate" name="val2">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt" name="xform">
    <p:input port="source">
      <p:pipe step="vcheck" port="valid"/>
    </p:input>
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>

0) default sequence to no

[Nota in that case, it seems that some need to be marked as yes]
<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline"
            primary-input="source"
            primary-output="result">
  <p:input port="source"/>
  <p:output port="result">
    <p:pipe step="xform" port="result"/>
  </p:output>

  <p:choose name="vcheck"
            primary-input="source"
            primary-output="valid">
    <p:input port="source">
       <p:pipe step="fig2" source="source"/>
    </p:input>
    <p:when test="/*[@version &lt; 2.0]">
      <p:output port="valid">
        <p:pipe step="val1" port="result"/>
      </p:output>
      <p:step type="p:validate" name="val1">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output port="valid">
        <p:pipe step="val2" port="result"/>
      </p:output>
      <p:step type="p:validate" name="val2">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt" name="xform">
    <p:input port="source">
      <p:pipe step="vcheck" port="valid"/>
    </p:input>
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>

1)

<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline">
  <p:input port="source"/>
  <p:output port="result">
    <p:pipe port="result"/>
  </p:output>

  <p:choose name="vcheck" primary-output="valid">
    <p:input port="source">
       <p:pipe source="source"/>
    </p:input>
    <p:when test="/*[@version &lt; 2.0]">
      <p:output port="valid">
        <p:pipe port="result"/>
      </p:output>
      <p:step type="p:validate" name="val1">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output port="valid">
        <p:pipe port="result"/>
      </p:output>
      <p:step type="p:validate" name="val2">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt" name="xform">
    <p:input port="source">
      <p:pipe port="valid"/>
    </p:input>
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>

2)

<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline">
  <p:input port="source"/>
  <p:output port="result">
    <p:pipe />
  </p:output>

  <p:choose name="vcheck" primary-output="valid">
    <p:input port="source">
       <p:pipe />
    </p:input>
    <p:when test="/*[@version &lt; 2.0]">
      <p:output port="valid">
        <p:pipe />
      </p:output>
      <p:step type="p:validate" name="val1">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output port="valid">
        <p:pipe/>
      </p:output>
      <p:step type="p:validate" name="val2">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt" name="xform">
    <p:input port="source">
      <p:pipe />
    </p:input>
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>

3)


<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline">
  <p:input port="source"/>
  <p:output port="result"/>

  <p:choose name="vcheck" primary-output="valid">
    <p:input port="source"/>
    <p:when test="/*[@version &lt; 2.0]">
      <p:output port="valid"/>
      <p:step type="p:validate" name="val1">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output port="valid"/>
      <p:step type="p:validate" name="val2">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt" name="xform">
    <p:input port="source"/>
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>

4)


<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline">
  <p:input port="source"/>
  <p:output port="result"/>

  <p:choose primary-output="valid">
    <p:input port="source"/>
    <p:when test="/*[@version &lt; 2.0]">
      <p:output port="valid"/>
      <p:step type="p:validate">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output port="valid"/>
      <p:step type="p:validate">
        <p:input port="source">
          <p:pipe step="fig2" port="source"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt">
    <p:input port="source"/>
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>

5)


<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline">
  <p:input/>
  <p:output/>

  <p:choose primary-output="valid">
    <p:input/>
    <p:when test="/*[@version &lt; 2.0]">
      <p:output/>
      <p:step type="p:validate">
        <p:input>
          <p:pipe step="fig2"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output />
      <p:step type="p:validate">
        <p:input>
          <p:pipe step="fig2"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt">
    <p:input/>
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>

6)

<p:pipeline name="fig2"
            xmlns:p="http://www.w3.org/2006/11/pipeline">
  <p:input/>
  <p:output/>

  <p:choose primary-output="valid">
    <p:input/>
    <p:when test="/*[@version &lt; 2.0]">
      <p:output/>
      <p:step type="p:validate">
        <p:input>
          <p:pipe step="fig2"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v1schema.xsd"/>
        </p:input>
      </p:step>
    </p:when>

    <p:otherwise>
      <p:output />
      <p:step type="p:validate">
        <p:input>
          <p:pipe step="fig2"/>
        </p:input>
        <p:input port="schema">
          <p:document href="v2schema.xsd"/>
        </p:input>
      </p:step>
    </p:otherwise>
  </p:choose>

  <p:step type="p:xslt">
    <p:input port="stylesheet">
      <p:document href="stylesheet.xsl"/>
    </p:input>
  </p:step>
</p:pipeline>


At result, I'm unclear why i still have
      <p:input>
          <p:pipe step="fig2"/>
        </p:input>

Should have missed something

Mohamed
-- 
Innovimax SARL
Consulting, Training & XML Development
9, impasse des Orteaux
75020 Paris
Tel : +33 8 72 475787
Fax : +33 1 4356 1746
http://www.innovimax.fr
RCS Paris 488.018.631
SARL au capital de 10.000 
Received on Friday, 22 December 2006 23:05:31 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:21:49 GMT