Page 1 of 1

How to use the XProc Input Tab properly

Posted: Thu Jan 14, 2021 1:34 am
by ttasovac
The Oxygen XML documentation for the XProc Input Tab reads:
The Inputs tab contains a list with the ports that the XProc script uses to read input data. Use the Filter text box to search for a specific term in the entire ports collection.

Each input port has an assigned name in the XProc script. The XProc engine reads data from the URL specified in the URL column.
I don't quite understand what that means. I have an XProc script which takes one xml document and runs two XSLT steps. The script works as is, but I would like to use oXygen variables instead of hard-coded @hrefs to the XSLT stylesheets.

So, how do I go from this:

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" name="generateDocumentation">
    <p:input port="source">
        <!--<p:document href="../TEILex0.odd"/>-->
    </p:input>
    <p:output port="result">
        <p:pipe port="result" step="odd2lite"/>
    </p:output>
    <p:xslt name="odd2odd">
        <p:input port="source">
            <p:pipe step="generateDocumentation" port="source"/>
        </p:input>
        <p:input port="stylesheet">     
            <p:document href="../../../../TEI-C/Stylesheets/odds/odd2odd.xsl" /> <!-- this i want to set in the Input Tab -->
        </p:input>
        <p:input port="parameters">
            <p:empty></p:empty>
        </p:input>
    </p:xslt>
    <p:xslt name="odd2lite">
        <p:input port="source">
            <p:pipe step="odd2odd" port="result"/>
        </p:input>
        <p:input port="stylesheet">
            <p:document href="../../../../TEI-C/Stylesheets/odds/odd2lite.xsl"/> <!-- this i want to set in the Input Tab -->
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>
    <p:store href="results-new/odd2lit.xml" method="xml" indent="false"/>
</p:declare-step>
to using oXygen variables in the XProc Input Tab for the two XSLT stylesheets?

At the moment I only have this:

Image

and this work because I could comment out the input file on the port "source" and add it to the XProc Input Tab, but I can't figure out how to do the same for the XSLT stylesheets.

Many thanks in advance.

All best,
Toma

Re: How to use the XProc Input Tab properly

Posted: Fri Jan 15, 2021 3:50 pm
by adrian
Hello,

You should declare the inputs for the two stylesheets in the "generateDocumentation" (top level) step (after the source port).

Code: Select all

    <p:input port="source">
        <!--<p:document href="../TEILex0.odd"/>-->
    </p:input>
    <p:input port="stylesheet1">
            <p:document href="../../../../TEI-C/Stylesheets/odds/odd2odd.xsl" /> 
    </p:input>
    <p:input port="stylesheet2">
            <p:document href="../../../../TEI-C/Stylesheets/odds/odd2lite.xsl"/>
    </p:input>
and within the <p:input port="stylesheet"> from each p:xslt call the pipe step with the needed port (stylesheet1/stylesheet2).
e.g. for odd2odd (stylesheet1).

Code: Select all

   <p:xslt name="odd2odd">
        <p:input port="source">
            <p:pipe step="generateDocumentation" port="source"/>
        </p:input>
        <p:input port="stylesheet">     
            <p:pipe step="generateDocumentation" port="stylesheet1"/>
        </p:input>
Do the same for odd2lite (stylesheet2).

The top level input ports can now be configured in the transformation scenario (Inputs tab).

Regards,
Adrian

Re: How to use the XProc Input Tab properly

Posted: Fri Jan 15, 2021 11:07 pm
by ttasovac
Thanks a lot Adrian! It makes perfect sense, of course, once you see it! I really appreciate your help.