Accessing Parameters in XPROC Script

Questions about XML that are not covered by the other forums should go here.
SixForty
Posts: 7
Joined: Sun May 09, 2021 7:34 am

Accessing Parameters in XPROC Script

Post by SixForty » Sun May 09, 2021 8:00 am

Hello, I'm still quite new to XML in general, so I'm not even sure if I'm asking the right question! But I'm hoping someone can point me in the right direction.

I'm trying to combine multiple steps of XSL stylesheets in an XPROC script for transforming data into multiple outputs. The data is currently in various text files - each text file will go through the same XPROC script, producing multiple outputs for each one. My first step pulls in the data from the text file and runs the first XSL transformation fine. The only problem is, I can't seem to figure out a way to create the XPROC script without hardcoding in the filename of the text file. Here's what 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="3.0">
    <p:input port="source"/>
    <p:input port="parameters" kind="parameter"/>
    <p:output port="result"/>

    <p:xslt name="step1">
        <p:input port="source">
            <p:data href="example.txt" wrapper="wrapperElement" wrapper-namespace="http://randomnamespace.org" wrapper-prefix="rns"/>
        </p:input>
        <p:input port="stylesheet">
            <p:document href="step1.xsl"/>
        </p:input>
        <p:input port="parameters">
            <p:empty/>
        </p:input>
    </p:xslt>

</p:declare-step>
This works great on my 'example.txt' file, but to run it on another file, I have to actually change the 'example.txt' filename in the script. I just can't seem to figure out how to have that created dynamically. I assumed that this would be a good case for a parameter passed into the XPROC script, but I've tried reading everything I can on XPROC parameters, and the OxygenXML XPROC Transformation Scenario configuration, and I simply can't wrap my head around how to make this work.

If anyone can offer any advice at all, I'd greatly appreciate it!

SixForty
Posts: 7
Joined: Sun May 09, 2021 7:34 am

Re: Accessing Parameters in XPROC Script

Post by SixForty » Wed May 12, 2021 11:39 am

Feel free to disregard this question. I changed up some workflow concepts, and was actually able to figure out a way to do what I needed entirely within XSL, with no need for XPROC.

Mircea
Posts: 90
Joined: Tue Mar 25, 2003 11:21 am

Re: Accessing Parameters in XPROC Script

Post by Mircea » Wed May 12, 2021 4:27 pm

Hello,

Maybe you can try to use the <p:for-each> step, that lets you perform a series of steps (a subpipeline) to all of the input documents you provide to it.

Unfortunatelly we do not have enough knowledge about this in order to offer you a sollution.
I recommend you to address this question on the XSLT list: xsl-list@lists.mulberrytech.com or at the XProc list: xproc-dev@w3.org

Regards,
Mircea.
Mircea Enachescu
<oXygen> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

SixForty
Posts: 7
Joined: Sun May 09, 2021 7:34 am

Re: Accessing Parameters in XPROC Script

Post by SixForty » Sun May 16, 2021 2:02 am

Thanks for the advice, Mircea. If I come across this problem again in the future, I shall give this a try.

crawford47
Posts: 2
Joined: Thu May 20, 2021 2:28 pm

Re: Accessing Parameters in XPROC Script

Post by crawford47 » Fri May 21, 2021 2:48 pm

Yes, <p:for-each> step is definitelly working.

Post Reply