XProc Source Variable

Here should go questions about transforming XML with XSLT and FOP.
Ali-a
Posts: 3
Joined: Tue May 05, 2020 7:34 am

XProc Source Variable

Post by Ali-a » Tue May 05, 2020 8:51 am

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 200 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

tavy
Posts: 216
Joined: Thu Jul 01, 2004 12:29 pm

Re: XProc Source Variable

Post by tavy » Tue May 05, 2020 4:30 pm

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
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com

Ali-a
Posts: 3
Joined: Tue May 05, 2020 7:34 am

Re: XProc Source Variable

Post by Ali-a » Tue May 05, 2020 5:57 pm

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

tavy
Posts: 216
Joined: Thu Jul 01, 2004 12:29 pm

Re: XProc Source Variable

Post by tavy » Wed May 06, 2020 6:02 pm

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
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com

Ali-a
Posts: 3
Joined: Tue May 05, 2020 7:34 am

Re: XProc Source Variable

Post by Ali-a » Thu May 07, 2020 5:50 pm

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 148 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

Radu
Posts: 6920
Joined: Fri Jul 09, 2004 5:18 pm

Re: XProc Source Variable

Post by Radu » Fri May 08, 2020 9:03 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply