Page 1 of 1
external program call
Posted: Sat Jun 07, 2008 6:27 pm
by romuld
Hello!
Can I use xslt transforming if I need to call some external program?
For example, during processing <mytag input_name="somename"/> by the template
<xsl:template match="mytag">
<xsl:variable name="output_name" select="concat('url(',$input_name,'.png',')')"/>
<!-- Here I need call to "my_program $output_name" -->
</xsl:template>
need call external executable "my_program", with parameters. I.e. some equivalent of 'exec' or 'system' in C-language.
Re: external program call
Posted: Mon Jun 09, 2008 10:44 am
by sorin_ristache
Hello,
You cannot call an external program from an XSLT stylesheet. You can do that only from an XSLT extension used in an XSLT stylesheet. In the implementation of an extension function or extension element you can do any processing allowed by the language used for writing the extension, including calling an external program. For example look
here for Saxon extensions and
here for Xalan extensions.
Regards,
Sorin
Re: external program call
Posted: Mon Jun 09, 2008 3:24 pm
by romuld
Thank you!
In Saxon it works!
This is an expression to call notepad.exe in Windows:
<xsl:value-of select="Runtime:exec(Runtime:getRuntime(), 'notepad.exe')"
xmlns:Runtime="java:java.lang.Runtime"/>
Re: external program call
Posted: Sun Oct 26, 2008 8:21 pm
by mjmanthey
When I transform the stylesheet (mentioned in this thread) extenally using Saxon (Transform.exe), I always get the following output:
<?xml version="1.0" encoding="UTF-8"?>java.lang.VMRuntime$DotNetProcess@38248fc
Does anyone see this? Is there anyway to prevent the output?
Re: external program call
Posted: Mon Oct 27, 2008 5:57 pm
by sorin_ristache
Hello,
It seems the .NET 1.1 framework is not installed or is not installed correctly on your Windows computer. I assume you refer to the Saxon.NET distribution, not the Saxon processor as Java library. Saxon.NET requires the .NET 1.1 framework available from the Microsoft website to be installed. Can you check that .NET 1.1 is installed correctly on your computer?
The same requirement is valid for using Saxon.NET in Oxygen as
documented in the User Manual.
Regards,
Sorin