I've a problem now. I noticed i've programmed the wrong thing.
My ASP Script(part of it)
XMLfilesrc = Request.Form("xmlfileid")
XSLfilesrc = Request.Form("xslfileid")
'Creating a NodeList of the elements in the XML Tree
Set objNodeList = objDom.documentElement.childNodes
'Loop through each item in the NodeList and check if its NodeType is that of a Processing Instruction i.e.
hrefsrc="href=""" &XSLFilesrc +""""
for i = 0 to objNodeList.length-1
If objNodeList.item(i).nodeType = 7 then
set objNewPI = objDom.createProcessingInstruction("xml-stylesheet"," ")
objNewPI.data = "type=""text/xsl"" " +hrefsrc
' objdom.documentElement.replaceChild objNewPI, objNodeList.item(i)
objdom.documentElement.replaceChild objNewPI, objDOM.childNodes(0)
This works perfectly and it does modify the processing line my xml file. But This only modify the processing instruction in the element node list. (which is in <text></text>
(XML that is modifled)
<?xml-stylesheet type="text/xsl" href="aflooding.xsl"?>
What i wanted was to put it after <?xml version="1.0">
so that i can run the xml file which will display according to the stylesheet after i use this asp to modify. Because currently it is inside <text></text> which i can output it with explorer just by double clicking. I've no idea how to do it out of the element list. Hope anyone can answer me..