简体   繁体   中英

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 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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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