0

我没有服务器上的磁盘访问权限,因此我需要从远程位置加载 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)
4

1 回答 1

0

尝试

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
于 2013-09-23T08:52:49.237 回答