- From: Imsieke, Gerrit, le-tex <gerrit.imsieke@le-tex.de>
- Date: Fri, 22 May 2020 19:54:39 +0200
- To: xproc-dev@w3.org
Hi Ahmed,
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'.
If all this is too abstract I can prepare and share a transformation
scenario and a minimal pipeline that prompts for a file path and loads
the URI into the pipeline.
Gerrit
On 22.05.2020 19:00, Ahmed Abdulhadi wrote:
> Hello David, Christophe,
>
> Thanks for your emails. Yes, I am using the ${ask()} variable which is
> supposed to prompt the user with a dialog box to choose a file. I
> originally posted the issue on the Oxygen support forum and was told
> that Oxygen doesn't support having the source passed as an ask variable
> (in the source tab). It does however support the ask variable in as a
> parameter (in the parameter tab) but I'm not sure how pass that
> parameter to the xproc as the <p:input port="source"/> . Radu
> recommended I contact this mailing list for additional help. Link below
> is the thread from the Oxygen Forum site where you can see screenshots
> of the issue:
> https://www.oxygenxml.com/forum/topic21435.html
>
> Thanks,
> Ahmed
>
> On Wed, May 20, 2020 at 2:13 AM David Cramer <david@thingbag.net
> <mailto:david@thingbag.net>> wrote:
>
> Hi Ahmed,
>
> You might also check the Oxygen support forums and/or documentation.
> Your issue does seem to be with the way you're invoking the
> pipeline. I believe that in an Oxygen transformation scenario using
> ${ask()} is meant to cause Oxygen to prompt the user for input, in
> this case the url of the source file, probably via a file chooser
> dialog. Perhaps somehow when prompted you provided the path to a
> directory instead of to a source file?
>
> If you're really trying to have Oxygen get a value from an
> environment variable, I think using ${env(VAR_NAME)} in the
> transform scenario does that, but definitely check the Oxygen
> docs/support forums/support for details.
>
> Regards,
>
> David
>
> On 5/19/20 12:24 PM, Christophe Marchand wrote:
>>
>> As you can see in the error message :
>>
>> * Error is raised by XProc engine, i.e. Calabash.
>> * Calabash received
>> "C:\Users\Ali\ExcelToXML\${ask('message',url)}" as input
>> document URL, which is not a valid URL, and probably isn't a
>> valid file on your file system.
>>
>> Try to run Calabash directly from command line, using Calabash
>> help : http://xmlcalabash.com/docs/
>>
>> java com.xmlcalabash.drivers.Main xpl/your-pipeline.xpl -i
>> source=C:\Users\Ali\ExcelToXML\your-file.xml
>>
>> Hth,
>> Christophe
>>
>> Le 11/05/2020 à 17:37, Ahmed Abdulhadi a écrit :
>>> Hello,
>>>
>>> I'm fairly new to XProc, and I am attempting to run a XProc where
>>> I run multiple stylesheet passes. As seen below:
>>>
>>> <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:input
>>> port="parameters" kind="parameter"/><p:output
>>> port="result"/><p:xslt name="firstPass"><p:input
>>> port="stylesheet"><p:document
>>> href="FirstPass.xsl"/></p:input></p:xslt><p:xslt><p:input
>>> port="stylesheet"><p:document
>>> href="SecondPass.xsl"/></p:input></p:xslt><p:xslt><p:input
>>> port="stylesheet"><p:document
>>> href="ThirdPass.xsl"/></p:input></p:xslt></p:declare-step>
>>>
>>>
>>> I'm running this through an Oxygen XML Editor Scenario that using
>>> the Calabash engine. I'm attempting to use an environmental
>>> variable in Oxygen for the source input. I want the user to
>>> specify the XML document saved on a file disk, and load that as
>>> the source:
>>> image.png
>>>
>>> However, I receive the following error below:
>>>
>>> err:XD0011 : XProc error err:XD0011 It isa dynamic error
>>> ifthe resource referenced bya p:documentelement does
>>> notexist, cannot be accessed, orisnota well-formed XML
>>> document. C:\Users\Ali\ExceltoXML\${ask('message', url)} (The
>>> system cannot find the file specified)
>>>
>>>
>>> I posted this specific question on the Oxygen forum site. I was
>>> informed that I can't use the ask variable in the input source
>>> but I could use it in the parameters.
>>>
>>> How do I pass the source as a dynamic variable or the source as a
>>> parameter?
>>>
>>> Thanks,
>>> Ahmed
Received on Friday, 22 May 2020 17:54:56 UTC