Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using ASP to dynamically apply xsl to multiple XML documents

Status
Not open for further replies.

gruvn

Programmer
Oct 15, 2004
24
CA
Hi all,
I've got a folder of many XML documents that are output directly from a software application I use (There is no style sheet associated with them).

I would like to share these over the web, but need to apply a style before I do. I have an XSL file that works (IE only), and would like to apply it dynamically to my XML files without editing the files themselves. I'd like to avoid embedding the stylesheet directly in to the XML because 1) I have numerous XML files, 2) the xsl sheet causes errors in non-IE browsers and 3) if I modify the XML and try and read them in the original program again, they will cause errors.

I think I managed to do this once (using ASP), but I can't remember how!!

Thanks for any help,
Mike
 
Figured it out.

If anyone else wants to know:

<% 'ASP code
xmlpath = "C:\dir\dir\file.xml"
xslpath = "C:\dir\style.xsl"
'Load the XML
set xml = Server.CreateObject("Microsoft.XMLDOM")
xml.async = false
xml.load(xmlpath)
'Load the XSL
set xsl = Server.CreateObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load(xslpath)
Response.Write(xml.transformNode(xsl))
%>

Thanks for looking,
M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top