After reading the XProc question below:
XSLT with XProc - parameter binding in the required type
Passing document() parameter to an xslt in XProc pipeline
It seems impossible to pass document-node() type parameter to XSLT in XProc.
So the only way to workaround is: generate temporary file and pass the URL of temporary file as parameter to XSLT.
Look following example:
big-command.xpl
<?xml version="1.0" encoding="UTF-8"?>
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
<p:output port="result">
<p:pipe port="result" step="final-calculation"/>
</p:output>
<p:xslt name="generate-temp-data" template-name="main">
<p:input port="source">
<p:empty/>
</p:input>
<p:input port="stylesheet">
<p:document href="generate-temp-data.xsl"/>
</p:input>
<p:input port="parameters">
<p:empty/>
</p:input>
</p:xslt>
<p:store name="store-temp-data" href="temp-data.xml"/>
<p:xslt name="final-calculation" >
<p:input port="source">
<p:document href="source-data.xml"/>
</p:input>
<p:input port="stylesheet">
<p:document href="final-calculation.xsl"/>
</p:input>
<p:with-param name="temp-data" select="/">
<p:pipe port="result" step="store-temp-data"/>
</p:with-param>
</p:xslt>
</p:declare-step>
final-calculation.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:param name="temp-data"/>
<xsl:variable name="temp-data-doc" select="doc($temp-data)"/>
<xsl:template match="/">
<final>
<xsl:for-each select="$temp-data-doc//record">
<xsl:value-of select="."/>
</xsl:for-each>
</final>
</xsl:template>
</xsl:stylesheet>
generate-temp-data.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template name="main">
<temp-data>
<record>1</record>
<record>2</record>
<record>3</record>
</temp-data>
</xsl:template>
</xsl:stylesheet>
source-data.xml
<?xml version="1.0" encoding="UTF-8"?>
<x/>
My question is:
Is this solution has sequential nor synchronized problem?
Is there any new solution in 2018?
How to safe delete temporary file: temp-data.xml?
@grtjn