Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: calling executable during transformation

From: "Anthony Jones" <Ant@------------.--->
To: NULL
Date: 3/3/2006 10:01:00 PM
<anywherenotes@g...> wrote in message
news:1141418119.940806.139100@p......
> Is there a way to call executable while performing xslt?
> So what I need, is to open an xml file (with embeded xsl document) in
> IE, and xsl would run executable to get part of data.
>
> My xml document contains data that has to be passed to executable to
> get additional data, for example, by document can contain stock name,
> and executable can lookup the price of the stock based on the name, so
> that the final output (on IE screen) would contain the stock name and
> price.
> The xml file and program are not looking up stock symbols, I am just
> trying illustrate why one would need this functionality.
>
> Is it possible to do what I am describing? (calling executable from xsl
> file?)
> This is not intended to hack anyone's system.  The file will be on the
> machine on which the browser is being opened, it's not being downloaded
> off the internet - it's a local file, so no security issues.
>
> Thank you.
> Alex


XSL will be subject to the same restrictions a IE.

But it would be something like this:-

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:msxsl="urn:schemas-microsoft-com:xslt"
  xmlns:script="urn:schemas-mycompany-com:script"
 >
 <xsl:output method="xml" encoding="UTF-8" />
  <msxsl:script language="JScript" implements-prefix="script">
function myFunc(nodelist) {
 var aObject = new ActiveXObject("myLib.myClass")
 return aObject.DoSomething(nodelist)
}
  </msxsl:script>

 <xsl:template match="/ | @* | * | node()">
  <xsl:copy>
   <xsl:apply-templates select="@* | * | node()" />
  </xsl:copy>
 </xsl:template>

 <xsl:template match="stkcode">
  <xsl:copy><xsl:value-of select="script:myFunc(.)" /></xsl:copy>
 </xsl:template>
</xsl:stylesheet>

In this example all elements with the tag 'stkcode' are passed to a method
called DoSomething on an instance of a myLib.myClass object.  The return
value is inserted in to the output.

Your myLib.dll will need to be installed and marked safe for scripting.

Anthony.




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent