<%
Function loadXMLFile(strXMLFile, strXSLFile)
'Declare local variables
Dim objServerXML
Dim objServerXSL
Dim objXML
Dim objXSL
'Instantiate the XMLDOM Object that will hold the XML and XSL file.
set objServerXML = Server.CreateObject("MSXML2.ServerXMLHTTP")
set objServerXSL = Server.CreateObject("MSXML2.ServerXMLHTTP")
objServerXML.open "GET", strXMLFile, false
objServerXML.send() ' Send the request.
objServerXSL.open "GET", strXSLFile, false
objServerXSL.send() ' Send the request.
if objServerXML.status = 200 Then
set objXML = Server.CreateObject("Microsoft.XMLDOM")
set objXSL = Server.CreateObject("Microsoft.XMLDOM")
set objXML = objServerXML.responseXML
set objXSL = objServerXSL.responseXML
'Use the "transformNode" method of the XMLDOM to apply the XSL
'stylesheet to the XML document. Then the output is written to the
'client.
'Response.Write(objXML.transformNode(objXSL))
'Response.Write(objXML.xml)
'Clean up
set objXML = Nothing
set objXSL = Nothing
end if
'Clean up
set objServerXML = Nothing
set objServerXSL = Nothing
End Function
'Get the DomainName and PageUrl
pageurl = Request.ServerVariables("URL")
sdomainname = Request.ServerVariables("HTTP_HOST")
'Uncomment the line below to use www.direct-link-ads.com for testing
'sdomainname = www.direct-link-ads.com
srequest = "http://www.direct-link-ads.com/RequestAds.aspx?domainname=" & sdomainname & "&pageurl=" & pageurl & "&Format=xml"
'Uncomment to check that the query is correct:
'Response.Write(srequest)
'Call the loadXMLFile Method, passing it the names of the XML and XSL files that you wish to load.
loadXMLFile srequest, "http://www.direct-link-ads.com/xml/Vertical.xsl"
'loadXMLFile srequest, "http://www.direct-link-ads.com/xml/Horizontal.xsl"
'Note: The 2 xsl files are basic examples and you may download them to your server and edit them to suit your website's look and feel.
%>
|