Re: Simplifying a series of simple p:xslt steps

> Would you mind elaborating on that?


Here is an implementation of Philip's solutions:

<?xml version="1.0"?>
<p:pipeline version="1.0" xmlns:p="http://www.w3.org/ns/xproc"  
xmlns:ex="http://www.example.com">

   <p:declare-step type="ex:xslt" name="xslt">
     <p:input port="source" sequence="true" primary="true"/>
     <p:input port="parameters" kind="parameter"/>
     <p:output port="result" primary="true"/>
     <p:output port="secondary" sequence="true"/>
     <p:option name="stylesheet" required="true"/>
     <p:load name="load-stylesheet">
       <p:with-option name="href" select="$stylesheet"/>
     </p:load>
     <p:xslt>
       <p:input port="stylesheet">
         <p:pipe port="result" step="load-stylesheet"/>
       </p:input>
       <p:input port="source">
         <p:pipe port="source" step="xslt"/>
       </p:input>
     </p:xslt>
   </p:declare-step>

   <ex:xslt name="remove-locations" stylesheet="preprocessors/remove- 
locations.xsl"/>
   <ex:xslt name="divisions-1" stylesheet="preprocessors/ 
divisions-1.xsl"/>
   <ex:xslt name="consolidate-descriptions" stylesheet="preprocessors/ 
consolidate-descriptions.xsl" />

</p:pipeline>

To make the document even more readable for your end users, you can  
extract the whole p:declare-step in its own XProc file (for instance  
ex-xslt.xpl) and then import with a p:import:

<?xml version="1.0"?>
<p:pipeline version="1.0" xmlns:p="http://www.w3.org/ns/xproc"  
xmlns:ex="http://www.example.com">

   <p:import href="ex-xslt.xpl"/>

   <ex:xslt name="remove-locations" stylesheet="preprocessors/remove- 
locations.xsl"/>
   <ex:xslt name="divisions-1" stylesheet="preprocessors/ 
divisions-1.xsl"/>
   <ex:xslt name="consolidate-descriptions" stylesheet="preprocessors/ 
consolidate-descriptions.xsl" />

</p:pipeline>

HTH,
Romain.

Le 12 oct. 10 à 17:51, Will McCutchen a écrit :

> Philip,
>
> On Tue, Oct 12, 2010 at 1:52 AM, Philip Fennell
> <Philip.Fennell@marklogic.com> wrote:
>> If you are desperate to simplify this then you can declare your own
>> pipeline step that encapsulates the p:xslt step. If all it is that
>> changes is the URL of the XSLT document then make that the single
>> option in your step. The down side to this is that because you
>> cannot parameterise the href attribute on the p:document instruction
>> you will need to use a p:load in your step in order to bring the
>> referenced transform into the pipeline. You'd end up with a sequence
>> of one line steps in you pipeline plus a reference to the library
>> module that your step declaration exists in.
>
> Would you mind elaborating on that?  I've been unable to figure out
> how to put it together myself... I'm a little overwhelmed by XProc, at
> the moment.  The solution you describe sounds like the exact solution
> I was hoping would be possible. A sequence of one line steps would be
> ideal for my use case.
>
>> That'd 'simplify' the appearance of the pipeline but obfuscate
>> what's going.
>
> I think I'm fine with that tradeoff.  This simplification is for the
> benefit of some end users who are a little uncomfortable making
> changes to these unfamiliar XML files.
>
> Thanks so much,
> - Hide quoted text -
>
>
> Will McCutchen.
> mccutchen@gmail.com
>

Received on Tuesday, 12 October 2010 16:32:40 UTC