Link to home
Start Free TrialLog in
Avatar of halfondj
halfondj

asked on

XSL question: What's the difference between a template processor vs. DOMDocument?

In my application, I'm currently using DOMDocument40 to load my XML and XSL files.

1. What is a template processor and when should it be used?
2. Using JavaScript, how is code written to use the template processor?

Thanks.

ASKER CERTIFIED SOLUTION
Avatar of rdcpro
rdcpro
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
made a boo boo in the code above:

var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument");

should be:

var xslDoc = new ActiveXObject("Msxml2.FreeThreadedDOMDocument.4.0");
Just to be clear, I gave you three examples of:

myProc.output = foo

You choose one of the three, as appropriate, and use it--not all three at the same time.  If you were doing this server-side, you'd probably write to the response stream directly, and call myProc.transform() at the point in the page where you want  the results to stream to the client.  

I guess I should proof read *before* I click submit!

Regards,
Mike Sharp
Avatar of halfondj
halfondj

ASKER

My application is standalone and will consist of a server side.  I'm then assuming that I should just use:

var xmlDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xmlDoc.async = false;
xmlDoc.load("myXMLData.xml");

var xslDoc = new ActiveXObject("Msxml2.DOMDocument.4.0");
xslDoc.async = false;
xslDoc.load("myStylesheet.xslt");

Also, I notice in all the examples that no one codes error handling.  Isn't it good to check if the the XML and XSL loaded?

Thanks.



 
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks again for the excellent description.  You certainly desearve all the points you get :).