XProc Source Variable

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

XProc Source Variable

Post 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 2699 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: 365
Joined: Thu Jul 01, 2004 12:29 pm

Re: XProc Source Variable

Post 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
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Ali-a
Posts: 6
Joined: Tue May 05, 2020 7:34 am

Re: XProc Source Variable

Post 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
tavy
Posts: 365
Joined: Thu Jul 01, 2004 12:29 pm

Re: XProc Source Variable

Post 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
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
Ali-a
Posts: 6
Joined: Tue May 05, 2020 7:34 am

Re: XProc Source Variable

Post 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 2647 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: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: XProc Source Variable

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
teo
Posts: 57
Joined: Wed Aug 30, 2017 3:56 pm

Re: XProc Source Variable

Post 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
Teodor Timplaru
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply