| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Member Join Date: Dec 2006
Posts: 138
![]() | |
| |
| | THREAD STARTER #3 (permalink) | ||||
| NamePros Member Join Date: Dec 2006
Posts: 138
![]() |
I get the xml document which works. Then I strip out the doctype, that works. I can then display the xml in a browser without the doctype. Everything is great so far. But then I can't figure out how to take the xml that i've stripped the doctype out of and then put it into my stylesheet. Thanks for taking a look... Michael <% Response.Buffer = True Dim objXMLHTTP, xml ' Create an xmlhttp object: Set xml = Server.CreateObject("Microsoft.XMLHTTP") ' Or, for version 3.0 of XMLHTTP, use: ' Set xml = Server.CreateObject("MSXML2.ServerXMLHTTP") ' Opens the connection to the remote server. xml.Open "GET", " case.xml", False ' Actually Sends the request and returns the data: xml.Send ????: NamePros.com http://www.namepros.com/showthread.php?t=333967 'Remove DOCTYPE Dim rx Set rx = New RegExp rx.Pattern = "<!DOCTYPE[^>]*>" Dim xmlNoDoctype xmlNoDoctype = rx.Replace(xml.responseText,"") Set rx = Nothing Set objFSO = Server.CreateObject ("Scripting.FileSystemObject") Path = Server.MapPath("/uploads/") FullPath = Path & "\Feed.xml" Set objTF = objFSO.CreateTextFile(FullPath,True) objTF.Write xmlNoDoctype 'the line below is commented out, but it simply write the xml to the browser without the doctype 'Response.Write xmlNoDoctype set xsl = Server.CreateObject("Microsoft.XMLDOM") xsl.async = false xsl.load(Server.MapPath("case.xsl")) ' The line below is what's throwing up. I'm not sure if I should be using xmlNoDocType below Response.Write (xmlNoDocType.transformNode(xsl)) Set xml = Nothing 'Set xsl = Nothing %> | ||||
| |
| | #4 (permalink) |
| NamePros Regular Join Date: Jul 2005 Location: Tucson, AZ
Posts: 689
![]() | Okay, so when you uncomment the line that prints the XML to the browser w/o the doctype, does that part function correctly? Does the XML it spits out parse, and pass a validation or at least a well-formedness check? If the regex works but the xsl transform does not, the XSL engine may have some trouble transforming it without a doctype. Try modifying the DOCTYPE or replacing it with a line describing the XML version and schema. |
| |
| | THREAD STARTER #5 (permalink) | ||||
| NamePros Member Join Date: Dec 2006
Posts: 138
![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=333967 When I uncomment that line, the xml prints to the browser without the doctype. That works. xml validates. I've downloaded the xml file and actually removed the doctype and the xsl transformed it fine. But when I use the regexp, remove the doctype, I get an error: Microsoft VBScript runtime error '800a01a8' Object required: '<?xml version="1.0" ' Which happens at the line in Response.Write (xmlNoDoctype.transformNode(xsl)) Thanks for helping out here! Michael | ||||
| |
| | #6 (permalink) |
| NamePros Regular Join Date: Jul 2005 Location: Tucson, AZ
Posts: 689
![]() | I'm wondering if the transform isn't a valid action for a string...you may need to instantiate a new xml node object and set its innerHTML (or equivalent) property to the actual xml, *then* try to transform it. |
| |
| | THREAD STARTER #7 (permalink) | ||||
| NamePros Member Join Date: Dec 2006
Posts: 138
![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=333967 do you have code that could help guide me by any chance? | ||||
| |
| | THREAD STARTER #9 (permalink) | ||||
| NamePros Member Join Date: Dec 2006
Posts: 138
![]() |
????: NamePros.com http://www.namepros.com/showthread.php?t=333967 If you have a php that does what I'm looking for, I'll jump ship in a heart beat. There's no loyalty here! | ||||
| |
| | #10 (permalink) |
| NamePros Regular Join Date: Jul 2005 Location: Tucson, AZ
Posts: 689
![]() | Let me see if I can dig up the code...I used to maintain my news section in RSS format and use an XSL to generate the page, but that was several site rewrites ago. As I recall it was really simple though. To get you started, here's the section of the php manual on xsl: http://us.php.net/xsl Here's the section on regex-based text replacement: http://us.php.net/manual/en/function.preg-replace.php |
| |