- From: Martin Honnen <martin.honnen@gmx.de>
- Date: Fri, 22 May 2020 20:17:12 +0200
- To: xproc-dev@w3.org
On 22.05.2020 19:54, Imsieke, Gerrit, le-tex wrote:
> instead of passing a document on an input port, it is possible to load
> it from the prompted location. This is what Radu was trying to tell you,
> by and large.
>
> You will declare a p:option for that (not a parameter, as Radu
> suggested, but that’s just a detail); it seems that $ask is also
> supported for options.
>
> You then use p:load[p:with-option[@name='href'][@select=$your-option]]
> instead of p:input[@port='source'] inside the pipeline.
>
> One issue is that p:load expects a file URI but you will probably get an
> operating system path from $ask. So on Windows you need to prepend
> 'file:///' to the absolute path, replace '\' with '/' and at least a
> space character in the file path (' ') with '%20'.
To spell out what Gerrit suggested, the following works for me with oXygen:
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step" version="1.0">
<p:option name="url"/>
<p:output port="result"/>
<p:load>
<p:with-option name="href" select="$url"/>
</p:load>
<p:xslt>
<p:input port="stylesheet">
<p:document href="FirstPass.xsl"/>
</p:input>
<p:input port="parameters">
<p:empty/>
</p:input>
</p:xslt>
<p:xslt>
<p:input port="stylesheet">
<p:document href="SecondPass.xsl"/>
</p:input>
<p:input port="parameters">
<p:empty/>
</p:input>
</p:xslt>
<p:xslt>
<p:input port="stylesheet">
<p:document href="ThirdPass.xsl"/>
</p:input>
<p:input port="parameters">
<p:empty/>
</p:input>
</p:xslt>
</p:declare-step>
In the XProc transformation scenario under "Options" for the "Value"
field of the "url" I have entered
${ask('Url?', url)}
And oXygen then offers a file selection dialog but returns a file: URL
(due to the type argument "url" in the "ask" call) so there is no need
to try to use replace to convert a file name into a URL.
Received on Friday, 22 May 2020 18:17:28 UTC