passing arguments to execute-processor

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

passing arguments to execute-processor

claude felizardo
Is there an example of building the argument list for an external program?

I'm trying to call an external program which is being written by someone
else.  I can hard code the argument but I need to call it what an
argument I get from my web form.  Here's part of my xpl file:

    <p:processor name="oxf:execute-processor">
        <p:input name="config">
            <exec dir="/path-to-data-directory"
                executable="/path-to-perl-program">
                <arg line="-metadata -test.dat"/>
            </exec>
        </p:input>
        <p:output name="stdout" id="stdout"/>
        <p:output name="stderr" id="stderr"/>
        <p:output name="result" id="result"/>
    </p:processor>
...

I can not figure out how to construct the argument on the fly.  I've
tried using concat() but then I get no output possibly due to bad input
handling of the perl program.

claude





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: passing arguments to execute-processor

Steve Bayliss
You could use an oxf:xslt processor to build the config input to the
oxf:execute-processor



-----Original Message-----
From: claude felizardo [mailto:[hidden email]]
Sent: 01 May 2009 03:50
To: [hidden email]
Subject: [ops-users] passing arguments to execute-processor


Is there an example of building the argument list for an external program?

I'm trying to call an external program which is being written by someone
else.  I can hard code the argument but I need to call it what an
argument I get from my web form.  Here's part of my xpl file:

    <p:processor name="oxf:execute-processor">
        <p:input name="config">
            <exec dir="/path-to-data-directory"
                executable="/path-to-perl-program">
                <arg line="-metadata -test.dat"/>
            </exec>
        </p:input>
        <p:output name="stdout" id="stdout"/>
        <p:output name="stderr" id="stderr"/>
        <p:output name="result" id="result"/>
    </p:processor>
...

I can not figure out how to construct the argument on the fly.  I've
tried using concat() but then I get no output possibly due to bad input
handling of the perl program.

claude






--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: passing arguments to execute-processor

Tom Grahame
Hi,

I was writing this as Steve posted, so I'll post it anyway.

Can you pass the argument from your form to the xpl on its instance input, dynamically construct the execute processor config as an xml fragment using an xslt processor and then pass the config (xml fragment) to the execute processor?

Something like this:

<p:param name="instance" type="input"/>

<p:processor name="oxf:xslt-2.0">
        <p:input name="data" href="#instance"/>
        <p:input name="config">
                <exec dir="/path-to-data-directory" executable="/path-to-perl-program" xsl:version="2.0">
                        <xsl:element name="arg">
                                <xsl:attribute name="line">
            <xsl:value-of select="/your-argument"/>
                                </xsl:attribute>
                        </xsl:element>
            </exec> 
        </p:input>
        <p:output name="data" id="execute-processor-config"/>
</p:processor>

<p:processor name="oxf:execute-processor">
        <p:input name="config" href="#execute-processor-config"/>
        <p:output name="stdout" id="stdout"/>
      <p:output name="stderr" id="stderr"/>
      <p:output name="result" id="result"/> 
</p:processor>

...

Obviously this won't work as it stands, but the idea is similar to a processor I have written.

HTH,

Tom

Steve Bayliss wrote
You could use an oxf:xslt processor to build the config input to the
oxf:execute-processor



-----Original Message-----
From: claude felizardo [mailto:claude@ipac.caltech.edu]
Sent: 01 May 2009 03:50
To: ops-users@ow2.org
Subject: [ops-users] passing arguments to execute-processor


Is there an example of building the argument list for an external program?

I'm trying to call an external program which is being written by someone
else.  I can hard code the argument but I need to call it what an
argument I get from my web form.  Here's part of my xpl file:

    <p:processor name="oxf:execute-processor">
        <p:input name="config">
            <exec dir="/path-to-data-directory"
                executable="/path-to-perl-program">
                <arg line="-metadata -test.dat"/>
            </exec>
        </p:input>
        <p:output name="stdout" id="stdout"/>
        <p:output name="stderr" id="stderr"/>
        <p:output name="result" id="result"/>
    </p:processor>
...

I can not figure out how to construct the argument on the fly.  I've
tried using concat() but then I get no output possibly due to bad input
handling of the perl program.

claude






--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: RE: passing arguments to execute-processor

Erik Bruchez
Administrator
And you can even use a more concise syntax:

     <p:param name="instance" type="input"/>

     <p:processor name="oxf:execute-processor">
         <p:input name="config" href="#instance" transform="oxf:xslt">
             <exec dir="/path-to-data-directory" executable="/path-to-
perl-program" xsl:version="2.0">
                 <xsl:element name="arg">
                     <xsl:attribute name="line">
                         <xsl:value-of select="/your-argument"/>
                     </xsl:attribute>
                 </xsl:element>
             </exec>
         </p:input>
         <p:output name="stdout" id="stdout"/>
         <p:output name="stderr" id="stderr"/>
         <p:output name="result" id="result"/>
     </p:processor>

-Erik

On May 1, 2009, at 1:59 AM, Tom Grahame wrote:

>
> Hi,
>
> I was writing this as Steve posted, so I'll post it anyway.
>
> Can you pass the argument from your form to the xpl on its instance  
> input,
> dynamically construct the execute processor config as an xml  
> fragment using
> an xslt processor and then pass the config (xml fragment) to the  
> execute
> processor?
>
> Something like this:
>
> <p:param name="instance" type="input"/>
>
> <p:processor name="oxf:xslt-2.0">
> <p:input name="data" href="#instance"/>
> <p:input name="config">
> <exec dir="/path-to-data-directory" executable="/path-to-perl-
> program"
> xsl:version="2.0">
> <xsl:element name="arg">
> <xsl:attribute name="line">
>             <xsl:value-of select="/your-argument"/>
> </xsl:attribute>
> </xsl:element>
>            </exec>
> </p:input>
> <p:output name="data" id="execute-processor-config"/>
> </p:processor>
>
> <p:processor name="oxf:execute-processor">
> <p:input name="config" href="#execute-processor-config"/>
> <p:output name="stdout" id="stdout"/>
>      <p:output name="stderr" id="stderr"/>
>      <p:output name="result" id="result"/>
> </p:processor>
>
> ...
>
> Obviously this won't work as it stands, but the idea is similar to a
> processor I have written.
>
> HTH,
>
> Tom
>
>
> Steve Bayliss wrote:
>>
>> You could use an oxf:xslt processor to build the config input to the
>> oxf:execute-processor
>>
>>
>>
>> -----Original Message-----
>> From: claude felizardo [mailto:[hidden email]]
>> Sent: 01 May 2009 03:50
>> To: [hidden email]
>> Subject: [ops-users] passing arguments to execute-processor
>>
>>
>> Is there an example of building the argument list for an external  
>> program?
>>
>> I'm trying to call an external program which is being written by  
>> someone
>> else.  I can hard code the argument but I need to call it what an
>> argument I get from my web form.  Here's part of my xpl file:
>>
>>    <p:processor name="oxf:execute-processor">
>>        <p:input name="config">
>>            <exec dir="/path-to-data-directory"
>>                executable="/path-to-perl-program">
>>                <arg line="-metadata -test.dat"/>
>>            </exec>
>>        </p:input>
>>        <p:output name="stdout" id="stdout"/>
>>        <p:output name="stderr" id="stderr"/>
>>        <p:output name="result" id="result"/>
>>    </p:processor>
>> ...
>>
>> I can not figure out how to construct the argument on the fly.  I've
>> tried using concat() but then I get no output possibly due to bad  
>> input
>> handling of the perl program.
>>
>> claude
>>
>>
>>
>>
>>
>>
>> --
>> You receive this message as a subscriber of the [hidden email]  
>> mailing
>> list.
>> To unsubscribe: mailto:[hidden email]
>> For general help: mailto:[hidden email]?subject=help
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>>
>
> --
> View this message in context: http://www.nabble.com/passing-arguments-to-execute-processor-tp23327860p23330153.html
> Sent from the ObjectWeb OPS - Users mailing list archive at  
> Nabble.com.
>
>
> --
> You receive this message as a subscriber of the [hidden email]  
> mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: RE: passing arguments to execute-processor

claude felizardo
Okay, if I try either Tom's or Erik's partial example, I get the
following error:

Error namespace URI of tag "arg" is wrong. It must be ""(schema:
http://orbeon.org/oxf/xml/execute-processor-config)

Here's what I have at the top of my xpl file:

<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:oxf="http://www.orbeon.com/oxf/processors"
          xmlns:xs="http://www.w3.org/2001/XMLSchema">
...

If I wrap everything around an xsl:stylesheet then I can use the
<xsl:element name="arg"> notation but I can't figure out how to extract
my argument.  Here's the last thing I tried:

    <p:param name="instance" type="input"/>

    <p:processor name="oxf:xslt">
        <p:input name="data" href="#instance"/>
        <p:input name="config">
          <xsl:stylesheet version="2.0">
           <xsl:template match="/">
           <xsl:variable name="arg" select="'/form/filename'"
as="xs:string"/>
            <exec dir="/path-to-data" executable="/path-to-perl-program">
                <xsl:element name="arg">
                    <xsl:attribute name="line">
                        <xsl:value-of select="$arg"/>
                    </xsl:attribute>
                </xsl:element>
            </exec>
           </xsl:template>
          </xsl:stylesheet>
        </p:input>
        <p:output name="data" id="execute-processor-config"/>
    </p:processor>

    <p:processor name="oxf:execute-processor">
        <p:input name="config" href="#execute-processor-config"/>
        <p:output name="stdout" id="stdout"/>
        <p:output name="stderr" id="stderr"/>
        <p:output name="result" id="result"/>
    </p:processor>
...


I've tried various combinations in side of the select statement.  If I
change it to '-help' I get my expected output but I can't get the
filename from the URL.  I suspect the match might be throwing things off
but I threw that in based on another file to get it to run w/o errors.

As for version of orbeon, it just says 3.7.0beta1.  I do not recall when
I snagged the nightly build.

claude


Erik Bruchez wrote:

> And you can even use a more concise syntax:
>
>     <p:param name="instance" type="input"/>
>
>     <p:processor name="oxf:execute-processor">
>         <p:input name="config" href="#instance" transform="oxf:xslt">
>             <exec dir="/path-to-data-directory"
> executable="/path-to-perl-program" xsl:version="2.0">
>                 <xsl:element name="arg">
>                     <xsl:attribute name="line">
>                         <xsl:value-of select="/your-argument"/>
>                     </xsl:attribute>
>                 </xsl:element>
>             </exec>
>         </p:input>
>         <p:output name="stdout" id="stdout"/>
>         <p:output name="stderr" id="stderr"/>
>         <p:output name="result" id="result"/>
>     </p:processor>
>
> -Erik
>
> On May 1, 2009, at 1:59 AM, Tom Grahame wrote:
>
>>
>> Hi,
>>
>> I was writing this as Steve posted, so I'll post it anyway.
>>
>> Can you pass the argument from your form to the xpl on its instance
>> input,
>> dynamically construct the execute processor config as an xml fragment
>> using
>> an xslt processor and then pass the config (xml fragment) to the execute
>> processor?
>>
>> Something like this:
>>
>> <p:param name="instance" type="input"/>
>>
>> <p:processor name="oxf:xslt-2.0">
>>     <p:input name="data" href="#instance"/>
>>     <p:input name="config">
>>         <exec dir="/path-to-data-directory"
>> executable="/path-to-perl-program"
>> xsl:version="2.0">
>>             <xsl:element name="arg">
>>                 <xsl:attribute name="line">
>>                        <xsl:value-of select="/your-argument"/>
>>                 </xsl:attribute>
>>             </xsl:element>
>>            </exec>
>>     </p:input>
>>     <p:output name="data" id="execute-processor-config"/>
>> </p:processor>
>>
>> <p:processor name="oxf:execute-processor">
>>     <p:input name="config" href="#execute-processor-config"/>
>>     <p:output name="stdout" id="stdout"/>
>>      <p:output name="stderr" id="stderr"/>
>>      <p:output name="result" id="result"/>
>> </p:processor>
>>
>> ...
>>
>> Obviously this won't work as it stands, but the idea is similar to a
>> processor I have written.
>>
>> HTH,
>>
>> Tom
>>
>>
>> Steve Bayliss wrote:
>>>
>>> You could use an oxf:xslt processor to build the config input to the
>>> oxf:execute-processor
>>>
>>>
>>>
>>> -----Original Message-----
>>> From: claude felizardo [mailto:[hidden email]]
>>> Sent: 01 May 2009 03:50
>>> To: [hidden email]
>>> Subject: [ops-users] passing arguments to execute-processor
>>>
>>>
>>> Is there an example of building the argument list for an external
>>> program?
>>>
>>> I'm trying to call an external program which is being written by
>>> someone
>>> else.  I can hard code the argument but I need to call it what an
>>> argument I get from my web form.  Here's part of my xpl file:
>>>
>>>    <p:processor name="oxf:execute-processor">
>>>        <p:input name="config">
>>>            <exec dir="/path-to-data-directory"
>>>                executable="/path-to-perl-program">
>>>                <arg line="-metadata -test.dat"/>
>>>            </exec>
>>>        </p:input>
>>>        <p:output name="stdout" id="stdout"/>
>>>        <p:output name="stderr" id="stderr"/>
>>>        <p:output name="result" id="result"/>
>>>    </p:processor>
>>> ...
>>>
>>> I can not figure out how to construct the argument on the fly.  I've
>>> tried using concat() but then I get no output possibly due to bad input
>>> handling of the perl program.
>>>
>>> claude
>>>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: RE: passing arguments to execute-processor

Hank Ratzesberger
Hi Claude,

I have this problem at least once a week, not specifying
a namespace, or the wrong one.

I have xmlns="" on my exec element, and apparently this
is required.

Fingers crossed,
Hank

> Okay, if I try either Tom's or Erik's partial example, I get the
> following error:
>
> Error namespace URI of tag "arg" is wrong. It must be ""(schema:
> http://orbeon.org/oxf/xml/execute-processor-config)
>
> Here's what I have at the top of my xpl file:
>
> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>           xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>           xmlns:oxf="http://www.orbeon.com/oxf/processors"
>           xmlns:xs="http://www.w3.org/2001/XMLSchema">
> ...
>
> If I wrap everything around an xsl:stylesheet then I can use the
> <xsl:element name="arg"> notation but I can't figure out how to extract
> my argument.  Here's the last thing I tried:
>
>     <p:param name="instance" type="input"/>
>
>     <p:processor name="oxf:xslt">
>         <p:input name="data" href="#instance"/>
>         <p:input name="config">
>           <xsl:stylesheet version="2.0">
>            <xsl:template match="/">
>            <xsl:variable name="arg" select="'/form/filename'"
> as="xs:string"/>
>             <exec dir="/path-to-data" executable="/path-to-perl-program">
>                 <xsl:element name="arg">
>                     <xsl:attribute name="line">
>                         <xsl:value-of select="$arg"/>
>                     </xsl:attribute>
>                 </xsl:element>
>             </exec>
>            </xsl:template>
>           </xsl:stylesheet>
>         </p:input>
>         <p:output name="data" id="execute-processor-config"/>
>     </p:processor>
>
>     <p:processor name="oxf:execute-processor">
>         <p:input name="config" href="#execute-processor-config"/>
>         <p:output name="stdout" id="stdout"/>
>         <p:output name="stderr" id="stderr"/>
>         <p:output name="result" id="result"/>
>     </p:processor>
> ...
>
>
> I've tried various combinations in side of the select statement.  If I
> change it to '-help' I get my expected output but I can't get the
> filename from the URL.  I suspect the match might be throwing things off
> but I threw that in based on another file to get it to run w/o errors.
>
> As for version of orbeon, it just says 3.7.0beta1.  I do not recall when
> I snagged the nightly build.
>
> claude
>
>
> Erik Bruchez wrote:
>> And you can even use a more concise syntax:
>>
>>     <p:param name="instance" type="input"/>
>>
>>     <p:processor name="oxf:execute-processor">
>>         <p:input name="config" href="#instance" transform="oxf:xslt">
>>             <exec dir="/path-to-data-directory"
>> executable="/path-to-perl-program" xsl:version="2.0">
>>                 <xsl:element name="arg">
>>                     <xsl:attribute name="line">
>>                         <xsl:value-of select="/your-argument"/>
>>                     </xsl:attribute>
>>                 </xsl:element>
>>             </exec>
>>         </p:input>
>>         <p:output name="stdout" id="stdout"/>
>>         <p:output name="stderr" id="stderr"/>
>>         <p:output name="result" id="result"/>
>>     </p:processor>
>>
>> -Erik
>>
>> On May 1, 2009, at 1:59 AM, Tom Grahame wrote:
>>
>>>
>>> Hi,
>>>
>>> I was writing this as Steve posted, so I'll post it anyway.
>>>
>>> Can you pass the argument from your form to the xpl on its instance
>>> input,
>>> dynamically construct the execute processor config as an xml fragment
>>> using
>>> an xslt processor and then pass the config (xml fragment) to the
>>> execute
>>> processor?
>>>
>>> Something like this:
>>>
>>> <p:param name="instance" type="input"/>
>>>
>>> <p:processor name="oxf:xslt-2.0">
>>>     <p:input name="data" href="#instance"/>
>>>     <p:input name="config">
>>>         <exec dir="/path-to-data-directory"
>>> executable="/path-to-perl-program"
>>> xsl:version="2.0">
>>>             <xsl:element name="arg">
>>>                 <xsl:attribute name="line">
>>>                        <xsl:value-of select="/your-argument"/>
>>>                 </xsl:attribute>
>>>             </xsl:element>
>>>            </exec>
>>>     </p:input>
>>>     <p:output name="data" id="execute-processor-config"/>
>>> </p:processor>
>>>
>>> <p:processor name="oxf:execute-processor">
>>>     <p:input name="config" href="#execute-processor-config"/>
>>>     <p:output name="stdout" id="stdout"/>
>>>      <p:output name="stderr" id="stderr"/>
>>>      <p:output name="result" id="result"/>
>>> </p:processor>
>>>
>>> ...
>>>
>>> Obviously this won't work as it stands, but the idea is similar to a
>>> processor I have written.
>>>
>>> HTH,
>>>
>>> Tom
>>>
>>>
>>> Steve Bayliss wrote:
>>>>
>>>> You could use an oxf:xslt processor to build the config input to the
>>>> oxf:execute-processor
>>>>
>>>>
>>>>
>>>> -----Original Message-----
>>>> From: claude felizardo [mailto:[hidden email]]
>>>> Sent: 01 May 2009 03:50
>>>> To: [hidden email]
>>>> Subject: [ops-users] passing arguments to execute-processor
>>>>
>>>>
>>>> Is there an example of building the argument list for an external
>>>> program?
>>>>
>>>> I'm trying to call an external program which is being written by
>>>> someone
>>>> else.  I can hard code the argument but I need to call it what an
>>>> argument I get from my web form.  Here's part of my xpl file:
>>>>
>>>>    <p:processor name="oxf:execute-processor">
>>>>        <p:input name="config">
>>>>            <exec dir="/path-to-data-directory"
>>>>                executable="/path-to-perl-program">
>>>>                <arg line="-metadata -test.dat"/>
>>>>            </exec>
>>>>        </p:input>
>>>>        <p:output name="stdout" id="stdout"/>
>>>>        <p:output name="stderr" id="stderr"/>
>>>>        <p:output name="result" id="result"/>
>>>>    </p:processor>
>>>> ...
>>>>
>>>> I can not figure out how to construct the argument on the fly.  I've
>>>> tried using concat() but then I get no output possibly due to bad
>>>> input
>>>> handling of the perl program.
>>>>
>>>> claude
>>>>
>>
>
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: RE: passing arguments to execute-processor

claude felizardo
Nope.  I tried adding xmlns="" as follows with the same results:

<exec xmlns="" dir="..." executable="..." xsl:version="2.0">
...

Error namespace URI of tag "arg" is wrong. It must be ""(schema:
http://orbeon.org/oxf/xml/execute-processor-config)

How do you parse this error message?  I tried adding xmlns="" to the
<xsl:element name="arg"> line and that didn't work either.

I have other xpl files that use exec and I did not have to add this and
they work fine but I guess it depends on what you have in your initial
config line.

I've got xpl files that either process arguments OR they try to do an
exec.  I just can't figure out how to do both in the same file.  If
someone can post a complete working example of say calling 'ls' but with
an argument that would help.

claude



Hank Ratzesberger wrote:

> Hi Claude,
>
> I have this problem at least once a week, not specifying
> a namespace, or the wrong one.
>
> I have xmlns="" on my exec element, and apparently this
> is required.
>
> Fingers crossed,
> Hank
>
>> Okay, if I try either Tom's or Erik's partial example, I get the
>> following error:
>>
>> Error namespace URI of tag "arg" is wrong. It must be ""(schema:
>> http://orbeon.org/oxf/xml/execute-processor-config)
>>
>> Here's what I have at the top of my xpl file:
>>
>> <p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
>>           xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>           xmlns:oxf="http://www.orbeon.com/oxf/processors"
>>           xmlns:xs="http://www.w3.org/2001/XMLSchema">
>> ...
>>
>> If I wrap everything around an xsl:stylesheet then I can use the
>> <xsl:element name="arg"> notation but I can't figure out how to extract
>> my argument.  Here's the last thing I tried:
>>
>>     <p:param name="instance" type="input"/>
>>
>>     <p:processor name="oxf:xslt">
>>         <p:input name="data" href="#instance"/>
>>         <p:input name="config">
>>           <xsl:stylesheet version="2.0">
>>            <xsl:template match="/">
>>            <xsl:variable name="arg" select="'/form/filename'"
>> as="xs:string"/>
>>             <exec dir="/path-to-data" executable="/path-to-perl-program">
>>                 <xsl:element name="arg">
>>                     <xsl:attribute name="line">
>>                         <xsl:value-of select="$arg"/>
>>                     </xsl:attribute>
>>                 </xsl:element>
>>             </exec>
>>            </xsl:template>
>>           </xsl:stylesheet>
>>         </p:input>
>>         <p:output name="data" id="execute-processor-config"/>
>>     </p:processor>
>>
>>     <p:processor name="oxf:execute-processor">
>>         <p:input name="config" href="#execute-processor-config"/>
>>         <p:output name="stdout" id="stdout"/>
>>         <p:output name="stderr" id="stderr"/>
>>         <p:output name="result" id="result"/>
>>     </p:processor>
>> ...
>>
>>
>> I've tried various combinations in side of the select statement.  If I
>> change it to '-help' I get my expected output but I can't get the
>> filename from the URL.  I suspect the match might be throwing things off
>> but I threw that in based on another file to get it to run w/o errors.
>>
>> As for version of orbeon, it just says 3.7.0beta1.  I do not recall when
>> I snagged the nightly build.
>>
>> claude
>>
>>
>> Erik Bruchez wrote:
>>> And you can even use a more concise syntax:
>>>
>>>     <p:param name="instance" type="input"/>
>>>
>>>     <p:processor name="oxf:execute-processor">
>>>         <p:input name="config" href="#instance" transform="oxf:xslt">
>>>             <exec dir="/path-to-data-directory"
>>> executable="/path-to-perl-program" xsl:version="2.0">
>>>                 <xsl:element name="arg">
>>>                     <xsl:attribute name="line">
>>>                         <xsl:value-of select="/your-argument"/>
>>>                     </xsl:attribute>
>>>                 </xsl:element>
>>>             </exec>
>>>         </p:input>
>>>         <p:output name="stdout" id="stdout"/>
>>>         <p:output name="stderr" id="stderr"/>
>>>         <p:output name="result" id="result"/>
>>>     </p:processor>
>>>
>>> -Erik
>>>
>>> On May 1, 2009, at 1:59 AM, Tom Grahame wrote:
>>>
>>>> Hi,
>>>>
>>>> I was writing this as Steve posted, so I'll post it anyway.
>>>>
>>>> Can you pass the argument from your form to the xpl on its instance
>>>> input,
>>>> dynamically construct the execute processor config as an xml fragment
>>>> using
>>>> an xslt processor and then pass the config (xml fragment) to the
>>>> execute
>>>> processor?
>>>>
>>>> Something like this:
>>>>
>>>> <p:param name="instance" type="input"/>
>>>>
>>>> <p:processor name="oxf:xslt-2.0">
>>>>     <p:input name="data" href="#instance"/>
>>>>     <p:input name="config">
>>>>         <exec dir="/path-to-data-directory"
>>>> executable="/path-to-perl-program"
>>>> xsl:version="2.0">
>>>>             <xsl:element name="arg">
>>>>                 <xsl:attribute name="line">
>>>>                        <xsl:value-of select="/your-argument"/>
>>>>                 </xsl:attribute>
>>>>             </xsl:element>
>>>>            </exec>
>>>>     </p:input>
>>>>     <p:output name="data" id="execute-processor-config"/>
>>>> </p:processor>
>>>>
>>>> <p:processor name="oxf:execute-processor">
>>>>     <p:input name="config" href="#execute-processor-config"/>
>>>>     <p:output name="stdout" id="stdout"/>
>>>>      <p:output name="stderr" id="stderr"/>
>>>>      <p:output name="result" id="result"/>
>>>> </p:processor>
>>>>
>>>> ...
>>>>
>>>> Obviously this won't work as it stands, but the idea is similar to a
>>>> processor I have written.
>>>>
>>>> HTH,
>>>>
>>>> Tom
>>>>
>>>>
>>>> Steve Bayliss wrote:
>>>>> You could use an oxf:xslt processor to build the config input to the
>>>>> oxf:execute-processor
>>>>>
>>>>>
>>>>>
>>>>> -----Original Message-----
>>>>> From: claude felizardo [mailto:[hidden email]]
>>>>> Sent: 01 May 2009 03:50
>>>>> To: [hidden email]
>>>>> Subject: [ops-users] passing arguments to execute-processor
>>>>>
>>>>>
>>>>> Is there an example of building the argument list for an external
>>>>> program?
>>>>>
>>>>> I'm trying to call an external program which is being written by
>>>>> someone
>>>>> else.  I can hard code the argument but I need to call it what an
>>>>> argument I get from my web form.  Here's part of my xpl file:
>>>>>
>>>>>    <p:processor name="oxf:execute-processor">
>>>>>        <p:input name="config">
>>>>>            <exec dir="/path-to-data-directory"
>>>>>                executable="/path-to-perl-program">
>>>>>                <arg line="-metadata -test.dat"/>
>>>>>            </exec>
>>>>>        </p:input>
>>>>>        <p:output name="stdout" id="stdout"/>
>>>>>        <p:output name="stderr" id="stderr"/>
>>>>>        <p:output name="result" id="result"/>
>>>>>    </p:processor>
>>>>> ...
>>>>>
>>>>> I can not figure out how to construct the argument on the fly.  I've
>>>>> tried using concat() but then I get no output possibly due to bad
>>>>> input
>>>>> handling of the perl program.
>>>>>
>>>>> claude
>>>>>
>>
>
>



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: RE: passing arguments to execute-processor

Hank Ratzesberger

Claude,

With some editing to remove tell-tale directories, and
using the two-step method of specific xslt step..
I hope this helps.

http://www.pastie.org/466942

Cheers,
Hank

> Nope.  I tried adding xmlns="" as follows with the same results:
>
> <exec xmlns="" dir="..." executable="..." xsl:version="2.0">
> ...
>
> Error namespace URI of tag "arg" is wrong. It must be ""(schema:
> http://orbeon.org/oxf/xml/execute-processor-config)
>
> How do you parse this error message?  I tried adding xmlns="" to the
> <xsl:element name="arg"> line and that didn't work either.
>
> I have other xpl files that use exec and I did not have to add this and
> they work fine but I guess it depends on what you have in your initial
> config line.
>
> I've got xpl files that either process arguments OR they try to do an
> exec.  I just can't figure out how to do both in the same file.  If
> someone can post a complete working example of say calling 'ls' but with
> an argument that would help.
>
> claude
>
>
>
> Hank Ratzesberger wrote:
>> Hi Claude,
>>
>> I have this problem at least once a week, not specifying
>> a namespace, or the wrong one.
>>
>> I have xmlns="" on my exec element, and apparently this
>> is required.
>>
>> Fingers crossed,
>> Hank
[snip]





--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Re: RE: passing arguments to execute-processor

claude felizardo
I was able to get a version of Tom's and Hank's examples working by
adding a default-submission attribute in my page-flow.xml file.

    <page id="test" path-info="/LoadTool/test/(.+)"
matcher="oxf:perl5-matcher"
            default-submission="default-form.xml"
            model="test.xpl">
        <setvalue ref="/form/filename" matcher-group="1"/>
    </page>

where default-form.xml contains the following:

    <form>
        <filename/>
   </form>

Makes sense now when you think about it but from the documentation in
sections 3.3 to 3.6, it sounded like this was optional:

http://www.orbeon.com/ops/doc/reference-page-flow#default-submission

I was not able to get Erik's "concise" version of constructing the arg
element on the fly to work. I had to construct a exec-config using
oxf:xslt processor then pass it to execute-processor.

BTW, I did not have to add xmlns="" to my exec element.

Thanks for the help!
claude


Hank Ratzesberger wrote:

> Claude,
>
> With some editing to remove tell-tale directories, and
> using the two-step method of specific xslt step..
> I hope this helps.
>
> http://www.pastie.org/466942
>
> Cheers,
> Hank
>
>  
>> Nope.  I tried adding xmlns="" as follows with the same results:
>>
>> <exec xmlns="" dir="..." executable="..." xsl:version="2.0">
>> ...
>>
>> Error namespace URI of tag "arg" is wrong. It must be ""(schema:
>> http://orbeon.org/oxf/xml/execute-processor-config)
>>
>> How do you parse this error message?  I tried adding xmlns="" to the
>> <xsl:element name="arg"> line and that didn't work either.
>>
>> I have other xpl files that use exec and I did not have to add this and
>> they work fine but I guess it depends on what you have in your initial
>> config line.
>>
>> I've got xpl files that either process arguments OR they try to do an
>> exec.  I just can't figure out how to do both in the same file.  If
>> someone can post a complete working example of say calling 'ls' but with
>> an argument that would help.
>>
>> claude
>>
>>
>>
>> Hank Ratzesberger wrote:
>>    
>>> Hi Claude,
>>>
>>> I have this problem at least once a week, not specifying
>>> a namespace, or the wrong one.
>>>
>>> I have xmlns="" on my exec element, and apparently this
>>> is required.
>>>
>>> Fingers crossed,
>>> Hank
>>>      
>
> [snip]
>
>
>
>  


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws