(Code Below)

I adapted the following code from a JavaScript and a VB Script that perform
the same function. I usually don't have any trouble doing this, but this
time, it's giving me fits. What is supposed to happen is that you pass in 4
variables:

source -> UNC Path to the XML Doc
style  -> UNC Path to the XSL Doc
param  -> Name of the <xsl:param> in the XSL Template
value  -> New value of the <xsl:param>

All appears to be working, except for the line: xslt.stylesheet=xslDoc; ...
apparantly the xslDoc value is null or doesn't contain the stylesheet when
MSXML attempts to apply changes to the copy being created here. I can't find
any documentation on MSXML2.FreeThreadedDOMDocument or MSXML2.XSLTemplate
COM objects. They're called as ActiveX Objects in the JavaScript, but I was
under the impression ActiveX was called the same as basic COM in CF.

I can get this to work flawlessly with the JavaScript, but of course, it's
IE only.

Any help greatly appreciated.

If you need (or want) to see the XML/XSL and CF code for this entire
process, email me off list at the address in my signature and I'll send you
a .zip file.

Thanks,


=========================== UDF CODE ===========================
/*
10/03/2001
v0.1 ALPHA | Passes a Variable to an XSL Document
Source = Fully Qualified Path to the XML Document
Style = Fully Qualified Path to the XSL Document
Param = Parameter to Set
Value = Value of Parameter to Set

Bugs in this version:
xslt.stylesheet=xslDoc;

Apparantly the xslDoc is not being loaded. The JavaScript version this
was adapted from needs the documents specified via virtual path, however,
the CF Versions (in the past) have required the documents to be specified
by full UNC path.
*/
function passVariable(source,style,param,value){
        var xslProc="";
        var xslOutput="";
        var objXML="";

        var xslt=CreateObject("COM","MSXML2.XSLTemplate", "INPROC");
        var objXSL=CreateObject("COM","MSXML2.FreeThreadedDOMDocument", "INPROC");

        objXSL.async="false";
        objXSL.load(style);

        xslt.stylesheet=objXSL;
        objXML=CreateObject("COM","MSXML2.DOMDocument", "INPROC");

        objXML.async="false";
        objXML.load(source);

        xslProc = xslt.createProcessor();
        xslProc.input = objXML;
        xslProc.addParameter(param, value);
        xslOutput=xslProc.transform();
        return xslOutput;
}

Joshua Miller
Web Development::Programming
Eagle Technologies Group, Inc.
www.eagletgi.com
[EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to