简体   繁体   English

在从RAM加载的IXMLDOMDocument上设置路径

[英]Setting a path on an IXMLDOMDocument that is loaded from RAM

I am using classic ASP. 我正在使用经典的ASP。 I have a stylesheet that is loaded into RAM already. 我有一个已加载到RAM中的样式表。 What my problem is, is my XSLT has an 我的问题是,我的XSLT有一个

<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. 当我从RAM加载到IXMLDOMDocument对象时,相对路径被抛出。 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. 现在,由于XSLT文件是从R​​AM加载的,因此计算机不知道如何找出xsl:include标记的相对路径。 So it attempts to pull the file from here: C:\\windows\\system32\\inetsrv 因此,它尝试从此处提取文件: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 将XSLT文件保存到所需的光盘上,然后使用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 从我要放置路径的位置加载“虚拟” XSLT文件,然后将其内容替换为RAM中的XSLT内容

I would really perfer some way to set the path I want it to use instead though. 我确实会提供一些方法来设置我想使用的路径。 Ideas? 有想法吗?

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. 我加载了XSLT文件,该文件保存在我希望基于其相对路径的位置。 I then ran removeChild commands on every child inside the document object. 然后,我在文档对象内的每个子对象上运行removeChild命令。 Then I did a cloneNode followed by an appendChild for every child that was in the XSLT in RAM. 然后,我为RAM中XSLT中的每个孩子创建了一个cloneNode,后跟一个appendChild。

I'm not sure if it was the best route performance wise but it accomplished what I was looking for. 我不确定这是否是最佳的路由性能,但它是否达到了我的期望。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM