Re: Multiple XSLT Steps with Secondary Outputs

On 23/01/2025 03:20, Don Smith wrote:
> I'm unable to understand how the connections should work between
> multiple xslt steps where each one has secondary output (and so all
> but the first have a sequence for an input).
>
> XProc Ref has an example pipeline in the p:xslt step documentation
> that I'll expand for discussion: https://xprocref.org/3.0/p.xslt.html
>
> My expansion of the pipeline consists in adding a second XSLT step
> that follows the first and takes as input the sequence of documents
> output by the first XSLT step (on secondary port). Both XSLT steps
> should have their sequence outputs written to disk by p:store. Here's
> my expansion of the example (minus the XSLT modules that are referenced):
>
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc" version="3.0">
>     <p:input port="source"/>
>     <p:output port="result" />
>     <p:xslt name="create-secondary-documents-1">
>         <p:with-input port="stylesheet" href="spec-split-docs-1.xsl"/>
>     </p:xslt>
>     <p:for-each name="step1-store">
>         <p:with-input pipe="secondary@create-secondary-documents-1"/>
>         <p:store href="{base-uri(/)}"/>
>         <p:identity>
> <p:with-input pipe="result-uri"/>
>         </p:identity>
>     </p:for-each>
>     <p:for-each>
>         <p:xslt name="create-secondary-documents-2">
> <p:with-input port="source"
> pipe="secondary@create-secondary-documents-1"/>
> <p:with-input port="stylesheet" href="spec-split-docs-2.xsl"/>
>         </p:xslt>
>     </p:for-each>
>     <p:for-each name="step2-store">
>         <p:with-input pipe="secondary@create-secondary-documents-2"/>
>         <p:store href="{base-uri(/)}"/>
>         <p:identity>
> <p:with-input pipe="result-uri"/>
>         </p:identity>
>     </p:for-each>
> </p:declare-step>
>
> I've tried every permutation of this I can think of and I can't get
> any of them to work. I'm sure that I'm missing something fundamental
> about connections but am not seeing it. Maybe I've got the pipeline
> concept entirely wrong for the requirement. In any case am asking for
> folks to enlighten me.
>
So how does a certain attempt fail, any error message you get? Which
XProc 3 processor do you use?

How do the XSLT stylesheets look, or at least how does the second xslt
look exactly that is supposed to process a sequence of results of the first?

And if the second XSLT expects a sequence of input documents, why is the
second p:xslt step wrapped in a p:for-each? It should just be a simple
p:xslt step with the p:with-input port="source"
pipe="secondary@create-secondary-documents-1" set up, without the
for-each wrapper.

Received on Thursday, 23 January 2025 11:46:54 UTC