[英]Is it possible to load a XSL stylesheet from a remote server in ASP classic
我在服务器上没有磁盘访问权限,因此需要从远程位置加载XSL样式表。
代替这个...
set xsl = Server.CreateObject("MSXML2.DOMDocument")
xsl.async = false
xsl.load(Server.MapPath("xsl.xsl"))
这样可以加载XSL样式表吗?
xsl.Open "get", "http://www.example.com/xsl.xsl" , False
xsl.Send
如果上述方法不可行,则可以将样式表内部放置在ASP文件中。 如果是这样,那是如何实现的?
更新-完整代码
Dim xml, xsl, url, url2
url = "https://www.example.xml"
url2 = "http://www.example.com/xsl/xsl.xsl"
Set xml = Server.CreateObject("Microsoft.XMLHTTP")
xml.Open "get", url, False
xml.Send
Response.ContentType = "text/xml"
set xsl = Server.CreateObject("MSXML2.DOMDocument")
xsl.async = false
xsl.load(Server.MapPath("xsl.xsl"))
'xsl.Open "get", url2, False
'xsl.Send
Response.AddHeader "Content-Type", "text/xml;charset=UTF-8"
Response.CodePage = 65001
Response.CharSet = "UTF-8"
Response.Write xml.responseXML.transformNode(xsl)
尝试
Dim req, sheet
Set req = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
req.open "GET", "http://example.com/sheet.xsl", False
req.send
If req.status = 200 Then
Set sheet = req.responseXML
...
Else
' handle HTTP problems here
End If
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.