设置从 RAM 加载的 IXMLDOMDocument 的路径
我正在使用经典的 ASP。我有一个样式表已经加载到 RAM 中。我的问题是,我的 XSLT
<xsl:include href="../path to file/file.xslt" />
中有一个。
当我将它从 RAM 加载到 IXMLDOMDocument 对象中时,相对路径就被抛弃了。这是我当前的代码
set XSLTObj = Server.CreateObject("Msxml2.XSLTemplate")
set XSLTObj.stylesheet = myXSLTFile
set XSLTProc = XSLTObj.createProcessor
现在,由于 XSLT 文件是从 RAM 加载的,因此计算机不知道如何找出 xsl:include 标记的相对路径。因此它尝试从这里提取文件: C:\windows\system32\inetsrv
我真的只需要一种方法来设置“默认路径”或以某种方式模拟它。我想到的几个选项(我真的不想做)是:
- 将 XSLT 文件保存到光盘上我想要的位置,然后使用 XSLTObj.load
- 从我想要的路径加载“虚拟”XSLT 文件是,然后将内容替换为 RAM 中的 XSLT 内容,但
我确实更喜欢某种方法来设置我希望它使用的路径。有想法吗?
I am using classic ASP. I have a stylesheet that is loaded into RAM already. What my problem is, is my XSLT has an
<xsl:include href="../path to file/file.xslt" />
in it.
When I load it from RAM into an IXMLDOMDocument object the relative path is thrown way off. Here is my current code
set XSLTObj = Server.CreateObject("Msxml2.XSLTemplate")
set XSLTObj.stylesheet = myXSLTFile
set XSLTProc = XSLTObj.createProcessor
Now since the XSLT file is loaded from RAM the computer doesn't know how to figure out the relative path for the xsl:include tag. So it attempts to pull the file from here:
C:\windows\system32\inetsrv
I really just need a way to set a "default path" or simulate it somehow. A couple of options I have thought of (that I don't really want to do) are:
- Save the XSLT file to disc where I want it, then use XSLTObj.load
- Load a "dummy" XSLT file from where I want my path to be, then replace the contents with the XSLT contents that's in RAM
I would really perfer some way to set the path I want it to use instead though. Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终做了清单上的第二个选项。我加载了一个 XSLT 文件,该文件保存在我希望相对路径基于的位置。然后,我对文档对象内的每个子项运行removeChild 命令。然后,我为 RAM 中 XSLT 中的每个子项执行了一个cloneNode,然后执行了一个appendChild。
我不确定这是否是最好的路线性能,但它实现了我所寻找的。
I ended up doing the second of my options on the list. I loaded an XSLT file that was saved at a spot where I was wanting my relative pathing to be based off of. I then ran removeChild commands on every child inside the document object. Then I did a cloneNode followed by an appendChild for every child that was in the XSLT in RAM.
I'm not sure if it was the best route performance wise but it accomplished what I was looking for.