Dear Joe,
Thanks for the quick answer.
Chris
Basically you use transformNodeToObject, there's an example here:
http://msdn.microsoft.com/en-us/library/ms766561(VS.85).aspx
If your output is XML then use the same logic as the example except
instead of the last line (WScript.echo) use result.save(<path to >
save to>).
If the output is not XML you can use an ADODB.Stream instead of a
DomDocument to accept the result and write to disk.
I guess you are talking about this example:
// Load data.
var source = new ActiveXObject("Msxml2.DOMDocument.3.0");
source.async = false;
source.load("hello.xml");
if (source.parseError.errorCode != 0) {
var myErr = source.parseError;
WScript.Echo("You have error " + myErr.reason);
} else {
// Load style sheet.
var stylesheet = new ActiveXObject("Msxml2.DOMDocument.3.0");
stylesheet.async = false;
stylesheet.load("hello.xsl");
if (stylesheet.parseError.errorCode != 0) {
var myErr = stylesheet.parseError;
WScript.Echo("You have error " + myErr.reason);
} else {
// Set up the resulting document.
var result = new ActiveXObject("Msxml2.DOMDocument.3.0");
result.async = false;
result.validateOnParse = true;
// Parse results into a result DOM Document.
WScript.Echo(source.transformNodeToObject(stylesheet, result));
}
}
Unfortunately, this is doing the reverse, calling a XSL transform from
Jscript. What I need is calling JScript from XSLT.
The following is the closest I found to what I need:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="http://mycompany.com/mynamespace">
<msxsl:script language="JScript" implements-prefix="user">
function xml(nodelist) {
return nodelist.nextNode().xml;
}
</msxsl:script>
<xsl:template match="/">
<xsl:value-of select="user:xml(.)"/>
</xsl:template>
</xsl:stylesheet>
However what I do not understand is, how to get an object that can be
saved in the msxsl:script block.
All the best,
Chris
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--