Martin Klang | 6 Feb 2005 01:53
Picon
Favicon

Re: Calling a function using a variable name

On 6 Feb 2005, at 0:21, Glen Barnes wrote:

> It seems as though I cannot set a parameter before compiling. Is there 
> another thing I have to run before the setParameter function?

ouch - that'd be a bug then.
There's a release coming very soon, I'll include a fix. Sorry for the 
inconvenience...
If you want to build from CVS, look in the file src/lang/Program.oml 
and move the line with 'program.compile()' to the constructor.

> 		      <o:set module_to_run="Program($prog_name)"/>
> 		      <o:do 
> select="$module_to_run.setParameter($module/param/ <at> name.string(), 
> String($module/param.string()))"/>
> 		      <o:eval select="$module_to_run.run()"/>

If you're setting more than one parameter you'll have to iterate over 
the config param's.
Otherwise looks just fine, it's my code that's faulty.

> Another thing. Can I run the program and pass the output through and 
> xsl transform before returning that to the calling program?

For sure - catch the output in a variable, then use that as input to an 
XSL transformation -
<o:import href="lib/xslt.oml"/>
<o:variable name="result">
  .. eval program ..
</o:variable>
<o:set source="xslt:Source($result)"/>
<o:set xslt="xslt:Transformer($xsltfile)"/>
<o:eval select="$xslt.transform($source)"/>

hth,

/m

Gmane