This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: multiple tranformations in XMLDOM
- From: "Américo Albuquerque" <aalbuquerque at viseu dot ipiaget dot pt>
- To: <xsl-list at lists dot mulberrytech dot com>
- Date: Thu, 18 Jul 2002 14:55:54 +0100
- Subject: RE: [xsl] multiple tranformations in XMLDOM
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Bryan
the msxml (the one you are using) has two load methods, load(file) and
loadXML(text)
what you want to do is something like this:
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.load("source.xml");
var xslDoc = new ActiveXObject("Microsoft.XMLDOM");
xslDoc.load("trans1.xsl");
var newxmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.transformNodeToObject(xslDoc,newxmlDoc);
// note: the result from trans1.xsl must be a well-formed xml or this
pass will fail
var htmlout = new ActiveXObject("Microsoft.XMLDOM");
htmlout.load("trans2.xsl");
var htmloutput = newxml.transformNode(htmlout);
document.write(htmloutput);
-----Original Message-----
From: owner-xsl-list@lists.mulberrytech.com
[mailto:owner-xsl-list@lists.mulberrytech.com] On Behalf Of Bryan
Tarantina
Sent: Wednesday, July 17, 2002 7:27 PM
To: xsl-list@lists.mulberrytech.com
Subject: [xsl] multiple tranformations in XMLDOM
Hey guys,
I have a small problem I am working on. Here's the
process:
source.xml + trans1.xsl -> out.xml
then:
out.xml + trans2.xsl -> out.html
This is all done with the XMLDOM in Javascript. I need
to go straight to the out.html file, so no saving
files in the interim steps. The trick: the out.xml
file actually contains html source I am treating as
XML (since it is well-formed).
Both XSL sheets have output specified as XML.
In Javascript I can create the variables and get each transformation
done separately (if I save out.xml as a file), but I am having problems
getting the second one to work off the direct output of the first.
Here's what I have in Javascript:
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM") xmlDoc.async="false"
xmlDoc.validateOnParse="false"
xmlDoc.load("source.xml")
var xslDoc = new ActiveXObject("Microsoft.XMLDOM") xslDoc.async="false"
xslDoc.load("trans1.xsl")
var newxmlDoc = new ActiveXObject("Microsoft.XMLDOM")
newxmlDoc.async="false"
newxmlDoc.load("out.xml")
var newxslDoc = new ActiveXObject("Microsoft.XMLDOM")
newxslDoc.async="false"
newxslDoc.load("trans2.xsl")
var htmlout = new ActiveXObject("Microsoft.XMLDOM")
htmlout.async="false" htmlout.validateOnParse="false"
htmlout = xmlDoc.transformNode(xslDoc)
var htmloutput = new ActiveXObject("Microsoft.XMLDOM")
htmloutput.async="false" htmloutput.validateOnParse="false"
htmloutput = htmlout.transformNode(newxslDoc)
document.write(htmloutput)
anyideas?
Bryan
__________________________________________________
Do You Yahoo!?
Yahoo! Autos - Get free new car price quotes http://autos.yahoo.com
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list