Re: Some hints on the basics

>>In diagram form, the flow is like this:
>>
>>input1.xml -> A -> B -> C -> result1C.xml
>>input2.xml -> A -> B -> C -> result2C.xml
>
>I meant, of course, result1C.xml + result2C.xml -> aggregate.xml
>
>>aggregate.xml -> D -> resultD.xml
>>
>>where A through D are all transformations.

Untested, here is an XProc that implements that flow

Using calabash, you need to bind the input files to the input ports
and the output file to the output port

If you don't want to do that, you can always use load and save

<?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"
     xmlns:html="http://www.w3.org/1999/xhtml"
     xmlns:ext="urn:wendell:piez:xproc:extensions"
     name="ABCD">

     <!-- *********** -->
     <!-- INPUT PORTS -->
     <!-- *********** -->

     <p:input port="input1" primary="true"/>
     <p:input port="input2"  primary="false"/>
     <p:input kind="parameter" port="parameters" primary="true"/>

     <!-- ************ -->
     <!-- OUTPUT PORTS -->
     <!-- ************ -->

     <p:output port="resultD" primary="true">
         <p:pipe step="special-metadata-pack" port="result"/>
     </p:output>
     <!-- serialization of the output -->
     <p:serialization port="resultD" indent="false" 
omit-xml-declaration="true"/>

     <!-- ********* -->
     <!-- SUB PIPES -->
     <!-- ********* -->

     <!-- ABC SUB PIPELINE -->
     <p:declare-step name="ABC" type="ext:abc">
         <p:input port="source" primary="true"/>
         <p:output port="result" primary="true"/>
         <!-- note that I inherit automatically the parameters of the 
entire pipeline here -->
         <p:input port="parameters" kind="parameter" primary="true"/>
         <p:xslt version="2.0">
             <p:input port="stylesheet">
                 <p:document href="XSLT/A.xsl"/>
             </p:input>
         </p:xslt>
         <p:xslt version="2.0">
             <p:input port="stylesheet">
                 <p:document href="XSLT/B.xsl"/>
             </p:input>
         </p:xslt>
         <p:xslt version="2.0">
             <p:input port="stylesheet">
                 <p:document href="XSLT/C.xsl"/>
             </p:input>
         </p:xslt>
     </p:declare-step>

     <!-- **** -->
     <!-- FLOW -->
     <!-- **** -->

     <ext:content-transformer name="result1C">
         <p:input port="source">
             <p:pipe port="input1" step="ABCD"></p:pipe>
         </p:input>
     </ext:content-transformer>

     <ext:content-transformer name="result2C">
         <p:input port="source">
             <p:pipe port="input2" step="ABCD"></p:pipe>
         </p:input>
     </ext:content-transformer>

     <p:pack wrapper="aggregate" name="aggregate">
         <p:input port="source">
             <p:pipe port="result" step="result1C"></p:pipe>
         </p:input>
         <p:input port="alternate">
             <p:pipe port="result" step="result2C"></p:pipe>
         </p:input>
     </p:pack>

     <p:xslt version="2.0" name="special-metadata-pack">
         <p:input port="source">
             <p:pipe port="result" step="aggregate"></p:pipe>
         </p:input>
         <p:input port="stylesheet">
             <p:document href="XSLT/D.xsl"/>
         </p:input>
     </p:xslt>


</p:declare-step>

cheers

Geert 

Received on Wednesday, 14 April 2010 18:22:06 UTC