I have a template which is passed a list of XML files to open and use within the template. It works fine, but now I have a problem being that I need to be able to change the XML file that is originally passed in the ASP. Here is the current code:
As you can see, I have an if condition. If the URL param is not present, or "all", then the it uses a file ("DVD_Cats.xml").
What I want to do, is that if this condition is not met, then I would like to construct an XML fragment:
I have tried the loadXML command, and can print it out to the screen; however, I can't figure out how I can use it to pass it to be used as input for the template, as the objXML instead of using the static file (above).
Please help. Until now, I have had to just re-direct to another template, but I am tired of doing so.
Code:
<%@ Language=VBScript %>
<%
Dim objTemplate, objProcessor, strSortField, strGameNumber, objXML, objXSL, strHTML, aSTR, Root, xmlDoc2
Set objXML = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
Set objXSL = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
Set xmlDoc2 = Server.CreateObject("Msxml2.FreeThreadedDOMDocument.3.0")
objXSL.async = False
objXSL.Load Server.MapPath("DVD_All_Temp.xsl")
Set objTemplate = Server.CreateObject("MSXML2.XSLTemplate.3.0")
Set objTemplate.stylesheet = objXSL
Set objProcessor = objTemplate.createProcessor
if cstr(Request.QueryString("Key")) = "all" or cstr(Request.QueryString("Key")) = "" then
objXML.async = False
objXML.Load Server.MapPath("DVD_Cats.xml")
objProcessor.input = objXML
call objProcessor.addParameter("Key", cstr(Request.QueryString("Key")))
objProcessor.Transform
strHTML = objProcessor.output
Response.write strHTML
else
xmlDoc2.async = False
xmlDoc2.loadXML("<cats TS=""""><cat name=""DVD_Cat_4.xml"" k=""4"" /></cats>")
Set Root = xmlDoc2.documentElement
'response.write(Root.xml)
objProcessor.input = Root.xml
' call objProcessor.addParameter("Key", cstr(Request.QueryString("Key")))
' objProcessor.Transform
end if
%>
As you can see, I have an if condition. If the URL param is not present, or "all", then the it uses a file ("DVD_Cats.xml").
What I want to do, is that if this condition is not met, then I would like to construct an XML fragment:
Code:
<cats TS="">
<cat name="DVD_Cat_4.xml" k="4" />
</cats>
I have tried the loadXML command, and can print it out to the screen; however, I can't figure out how I can use it to pass it to be used as input for the template, as the objXML instead of using the static file (above).
Please help. Until now, I have had to just re-direct to another template, but I am tired of doing so.