Seeing nothing on the secondary port on an xslt step

Hello XProc friends,

At the bottom appears an XProc, or what seems to be an XProc, except it throws an error in Morgana.

It fails because while the 'end' step captures the secondary port on the 'an-xslt' step, nothing appears on secondary, and it is not allowed to be empty (it is not declared as a sequence). Adding sequence='true' to p:output lets the pipeline finish without error - but no visible result either.

If I add xsl:result-document/@href (any href at all), the document appears on the secondary port.

I guess this is conformant behavior since the relevant specs are pretty open?

In any case I am wondering if (a) I understand correctly, and (b) if there is a way I can mitigate this easily without altering the XSLT.

This is because in the actual problem I am addressing, the XSLT is not inline, but instead is produced dynamically by the XSpec test compiler, here (see especially line 140):

https://github.com/xspec/xspec/blob/65c701eb8e170949bf82d0f74aa970d40498ccee/src/compiler/xslt/main.xsl#L140

Thanks! Any advice is welcome.

<p:declare-step xmlns:p=http://www.w3.org/ns/xproc
   xmlns:c=http://www.w3.org/ns/xproc-step version="3.0"
   xmlns:x=http://www.jenitennison.com/xslt/xspec
   name="test-xslt-secondary"
   xmlns:xsl=http://www.w3.org/1999/XSL/Transform>

   <p:output port="result" pipe="result@end"/>

   <p:xslt name="an-xslt">
      <p:with-input port="source"><p:empty/></p:with-input>
      <p:with-input port="stylesheet">
         <p:inline expand-text="false">
            <xsl:stylesheet version="3.0" exclude-result-prefixes="#all">
               <xsl:template name="go">
                  <xsl:result-document>
                    <go>FISH!</go>
                  </xsl:result-document>
               </xsl:template>
            </xsl:stylesheet>
         </p:inline>
      </p:with-input>
      <p:with-option name="template-name" select="'go'"/>
   </p:xslt>

   <p:identity name="end">
      <p:with-input port="source" pipe="secondary@an-xslt"/>
   </p:identity>

</p:declare-step>

Received on Friday, 14 June 2024 14:33:22 UTC