0

I have an XProc pipeline which takes a source document and transforms it using several <p:xslt> steps, storing along the way intermediate results (I need those as well).

This is pretty straightforward and works very well. But in the last step, where the input is already an html document, my xslt looks like this:


<xsl:template match="div[@id = 'specification']">
    <xsl:result-document href="spec.html">
        <xsl:copy>
            <xsl:apply-templates/>
        </xsl:copy>
    </xsl:result-document>
</xsl:template>
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

Now if I was running this transformation directly, using XSLT, the main output of the transformation would be a file with everything but the div whose id="spec"; and a secondary output would be the contents of div id="spec", which would go into spec.html, as required by xsl:result-document.

Unfortunately, XProc does not create an output for xsl:result-document and, as far as I can tell, wants us to deal with primary and secondary output ports for this. I have read the specification and the few examples out there multiple times, but I still cannot figure out something which should be relatively simple, how to go from:

<p:xslt name="post-process">
    <p:input port="source">
        <p:pipe step="html" port="result"/>
    </p:input>
    <p:input port="stylesheet">
        <p:document href="../stylesheets/html-post-process.xsl"/>
    </p:input>
</p:xslt>

to something else in XProc which would give me two different outputs and the ability to save both the main output and the secondary output (a là xsl:result-document).

I would be most grateful for your tips or examples.

Tench
  • 485
  • 3
  • 18

0 Answers0