Use Case 5.6 - Multiple-file Command-line Document Generation

For input:

<documents>
<document href="a.xml"/>
<document href="b.xml"/>
</documents>

Version 1:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
    xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
   <p:input port="source"/>
   <p:output port="result"/>
   <p:viewport match="/*/document">
      <p:output port="result">
         <p:pipe port="result" step="store"/>
      </p:output>
      <p:load>
         <p:with-option name="href" select="/document/@href"/>
      </p:load>
      <p:xslt>
         <p:input port="stylesheet">
            <p:document href="transform.xsl"/>
         </p:input>
         <p:input port="parameters">
            <p:inline><c:param-set/></p:inline>
         </p:input>
      </p:xslt>
      <p:store name="store">
         <p:with-option name="href" select="concat(base-uri(),'.html')"
></p:with-option>
      </p:store>
   </p:viewport>
</p:declare-step>


Version 2:

<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
    xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
   <p:input port="source"/>
   <p:viewport match="/*/document">
      <p:load>
         <p:with-option name="href" select="/document/@href"/>
      </p:load>
      <p:xslt>
         <p:input port="stylesheet">
            <p:document href="transform.xsl"/>
         </p:input>
         <p:input port="parameters">
            <p:inline><c:param-set/></p:inline>
         </p:input>
      </p:xslt>
   </p:viewport>
   <p:store name="store">
      <p:with-option name="href" select="concat(base-uri(),'.out')"
></p:with-option>
   </p:store>
</p:declare-step>


-- 
--Alex Milowski
"The excellence of grammar as a guide is proportional to the paucity of the
inflexions, i.e. to the degree of analysis effected by the language
considered."

Bertrand Russell in a footnote of Principles of Mathematics

Received on Wednesday, 6 March 2013 18:11:33 UTC