View XML File via XMLDOM and XSLT

admin

Administrator
Staff member
I have an XML file which i transform using an XSL file. In ASP i use the following code to change a couple of variables in the XML file before transforming it with the XSL file (the variables determine which parts of the xml are displayed);

"
'--Select Parameters element and amend according to querystring info
set objNode = objXML.getElementsByTagName("parameters")
call objNode.item(0).setAttribute("id_view",intIDView)
call objNode.item(0).setAttribute("columns",intColumns)

'--Load XSL
set objXSL = Server.CreateObject("Microsoft.XMLDOM")
objXSL.async = false
objXSL.load(Server.MapPath(strXSLFile))

'--Transform file
Response.Write(objXML.transformNode(objXSL))

Set objXML = nothing
Set objXSL = nothing
Set objNode = nothing
"

The xml file looks like this;

"
<?xml version='1.0'?>

<gallery>

<!--Updated from view.asp page-->
<parameters id_view="10" columns="1" id_image="dr0001"/>

......all the other elements
</gallery>
"

It works fine but I am not sure this is the best way to achieve my aim (which is to have an xml file which has the content details formatted by the XSL based on variables set on obtained from an .asp page).

Any advice would be gratefully accepted.

Yours

Wastlinger
 
Back
Top