I'm using XProc to run an XSLT that spits out numerous result-documents (using the xsl:result-document). I'm unsure how to go about adding a variable for the @href in the step. I've got the below XProc:
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
<p:input port="source">
<p:empty/>
</p:input>
<p:xslt name="pagelist">
<p:input port="stylesheet">
<p:document href="file:/C:/page-list.xsl"/>
</p:input>
<p:input port="source">
<p:document href="file:/C:/toc.xml"/>
</p:input>
<p:input port="parameters">
<p:empty/>
</p:input>
</p:xslt>
<p:store name="pagelist" indent="true">
<p:with-option name="method" select="'xml'" />
<p:with-option name="href" select="" />
</p:store>
How do I add a variable in the XProc that will match the output filename from the xsl:result-document?
XSLT snippet, if needed:
<xsl:result-document href="{xhtml:a[@class='ref-uri']/@id}_pagelist.xml" method="xml" include-content-type="no" indent="no">
Using Calabash 1.1.30 from the command line I was able to get the following to work:
So basically a
p:for-eachover ap:iteration-sourcethat uses thesecondaryresult output port from thep:xsltstep and then inside simply usesdocument-uri(.)to have the result URI. All this requiresxpath-version="2.0".Somehow oXygen 22 doesn't run the code but gives me an access denied error, it seems to be set up to write secondary documents to the oXygen installation directory which with normal Windows security settings is not allowed and is not a place where you want result files anyhow; to fix that problem I have adjusted the XProc to have the XML input as a input source to the whole XProc script, then in the
p:xsltstep I can use the functionp:base-urito set theoutput-base-urifor XSLT:That way Calabash from the command line and within oXygen behave the same, writing the results to the same directory as the input source comes from.