Modular pipeline

<p:library xml:id="b3-modular"
	   xmlns:p="http://www.w3.org/ns/xproc"
	   xmlns:cx="http://xmlcalabash.com/ns/extensions"
	   xmlns:pl="http://www.w3.org/XML/XProc/docs/library">

<p:declare-step name="main" type="pl:main">
  <p:input port="parameters" kind="parameter"/>

  <pl:format-spec>
    <p:input port="source">
      <p:document href="langspec.xml"/>
    </p:input>
  </pl:format-spec>

  <pl:tidy href="langspec.html"/>
</p:declare-step>

<p:declare-step name="main" type="pl:format-spec">
  <p:input port="source"/>
  <p:input port="parameters" kind="parameter"/>
  <p:output port="result"/>

  <p:xinclude/>

  <p:validate-with-relax-ng>
    <p:input port="schema">
      <p:document href="../schema/dbspec.rng"/>
    </p:input>
  </p:validate-with-relax-ng>

  <p:xslt name="style">
    <p:input port="stylesheet">
      <p:document href="../style/dbspec.xsl"/>
    </p:input>
  </p:xslt>
</p:declare-step>

<p:declare-step type="pl:tidy">
  <p:input port="source"/>
  <p:option name="href" required="true"/>

  <p:store name="store">
    <p:with-option name="href" select="$href"/>
  </p:store>

  <p:exec result-is-xml="false"
	  source-is-xml="false"
	  command="/Users/ndw/bin/tidy"
	  cx:depends-on="store">
    <p:with-option name="args" select="$href">
      <p:empty/>
    </p:with-option>
    <p:input port="source"><p:empty/></p:input>
  </p:exec>

  <p:sink/>
</p:declare-step>

</p:library>