Page 1 of 1

XProc Source Variable

Posted: Tue May 05, 2020 8:51 am
by Ali-a
Hello,

I'm fairly new to XProc, but I am running a XProc where I am running multiple stylesheet passes. As seen below:

Code: Select all

<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 attempting to use an environmental variable in Oxygen for the source.
image.png
image.png (45.96 KiB) Viewed 2691 times
Receiving the error below:

Code: Select all

 err:XD0011 : XProc error err:XD0011 It is a dynamic error if the resource referenced by a p:document element does not exist, cannot be accessed, or is not a well-formed XML document. C:\Users\Ali\ExceltoXML\${ask('message', url)} (The system cannot find the file specified)
How do I pass the source as an editor ask variable.

Thanks,
Ali

Re: XProc Source Variable

Posted: Tue May 05, 2020 4:30 pm
by tavy
Hello Ali,

Thanks for your feedback.
Unfortunately we do not have support to provide the source as an ask editor variable. Only the transformation parameters can be passed as an ask editor variable.
I added an issue on our issue tracker to add this support in a future version. We will update this thread when the issue will be solved.

Best Regards,
Octavian

Re: XProc Source Variable

Posted: Tue May 05, 2020 5:57 pm
by Ali-a
Thanks Octavian. Is there any other way I can have a user specify a file on a directory so that they can run a XProc transformation on it?

Thanks,
Ali

Re: XProc Source Variable

Posted: Wed May 06, 2020 6:02 pm
by tavy
Hello Ali,

I am not an XProc expert. Probably you can do this if you can pass the source as a parameter, and use the ${ask} editor variable in the parameter.

Best Regards,
Octavian

Re: XProc Source Variable

Posted: Thu May 07, 2020 5:50 pm
by Ali-a
Thanks Octavian, I'm new to XProc as well. I guess I'm not sure how to do that myself.

I can add the parameter on the parameter tab and the ask msg will show up as expected when I run the XProc
image.png
image.png (93.55 KiB) Viewed 2639 times
However, I'm not sure how to then utilize that parameter in the XProc for the main <p:input port="source"/>?

I get the error:

Code: Select all

Either a source document, an initial template or an initial function must be specified
Here is the latest XProc I have:

Code: Select all

<?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:input port="parameters" kind="parameter"/>
    <p:input port="source">
        <p:document href="{$source}"/>
    </p:input>
    <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>
If anyone knows how I can make that link between the passed parameter and the primary input source?

Thanks,
Ahmed

Re: XProc Source Variable

Posted: Fri May 08, 2020 9:03 am
by Radu
Hi Ahmed,

We are not very familiar with the XProc standard as we do not use it much internally. Maybe you can ask XProc specific questions on the XProc users list:

https://lists.w3.org/Archives/Public/xproc-dev/

Regards,
Radu

Re: XProc Source Variable

Posted: Fri Nov 20, 2020 4:23 pm
by teo
Hi,

Just wanted to update this thread and let you know that the recently released Oxygen 23 should have a fix for the issue you reported here.

Kind regards,
Teo