- From: James Fuller <james.fuller.2007@gmail.com>
- Date: Wed, 14 Apr 2010 20:17:52 +0200
- To: Wendell Piez <wapiez@mulberrytech.com>
- Cc: xproc-dev@w3.org
Hello Wendell, ok, taking your process description, as follows (to make sure I got it right) ' input1.xml -> A -> B -> C -> result1C.xml input2.xml -> A -> B -> C -> result2C.xml result1C.xml + result2C.xml -> aggregate.xml aggregate.xml -> D -> resultD.xml where A through D are all transformations.' I have tried to emulate such a process, but probably oversimplified your requirements. <?xml version="1.0" encoding="UTF-8"?> <p:pipeline name="w1" xmlns:p="http://www.w3.org/ns/xproc" version="1.0"> <p:input port="input1"> <p:inline> <inputa>source data from input1</inputa> </p:inline> </p:input> <p:input port="input2"> <p:inline> <inputb>source data from input2</inputb> </p:inline> </p:input> <p:xslt name="step1"> <p:input port="source"> <p:pipe port="input1" step="w1"></p:pipe> </p:input> <p:input port="stylesheet"> <p:inline> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <testa>This is the result or xslt processing from step1 <xsl:copy-of select="."/> </testa> </xsl:template> </xsl:stylesheet> </p:inline> </p:input> </p:xslt> <p:xslt name="step2"> <p:input port="source"> <p:pipe port="input2" step="w1"></p:pipe> </p:input> <p:input port="stylesheet"> <p:inline> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <testb>This is the result of xslt processing from step2 <xsl:copy-of select="."/> </testb> </xsl:template> </xsl:stylesheet> </p:inline> </p:input> </p:xslt> <p:pack> <p:input port="source"> <p:pipe port="result" step="step1"></p:pipe> </p:input> <p:input port="alternate"> <p:pipe port="result" step="step2"></p:pipe> </p:input> <p:with-option name="wrapper" select="'wrapper'"/> </p:pack> <p:xslt name="step4"> <p:input port="stylesheet"> <p:inline> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <transformd><xsl:copy-of select="."/></transformd> </xsl:template> </xsl:stylesheet> </p:inline> </p:input> </p:xslt> </p:pipeline> </p:pipeline> This xproc has 4 distinct steps. step1: uses input1 and transforms with inline stylesheet step2: uses input2 and transforms with inline stylesheet step3: aggregates the results of step1 and step2 ... notice how we need to use p:pipe elements to address a certain steps output port step4: applies transform to the output of step3, which is naturally piped through A few things to keep in mind: * you can use p:document to define some external document wherever I have used p:inline definition ... also if you are using oxygen you can setup which documents come into the xproc by defining the input ports defined in the transformation scenario * XProc is designed to facilitate the simplest straight through processing pipeline e.g. when steps omit p:input and p:output xml flows between steps automatically ... once you stray from this default scenario you will need to start using p:pipe to prescriptively describe what data to use for input. * you can easily encapsulate each step into a separate defined p:declare-step and bring these in by p:import ... I would do this kind of optimization as a last step * note that parameters are useful when used with p:xslt The result you should get is the following: <transformd> <wrapper> <testa>This is the result or xslt processing from step1 <inputa>source data from input1</inputa> </testa> <testb>This is the result of xslt processing from step2 <inputb>source data from input2</inputb> </testb> </wrapper> </transformd> hth as a starting point, James Fuller
Received on Wednesday, 14 April 2010 18:18:28 UTC