开发者

Setting a path on an IXMLDOMDocument that is loaded from RAM

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 开发者_如何学Cthe 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?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜