Kozical Posted January 10, 2007 Share Posted January 10, 2007 Well, Since my last post I made much progress, and I've gotten php5 uploaded onto my webserver since, also the save function works great.. (thanks beon_robot)I've gotten to another standstill trying to keep the site crossbrowser compatible. I believe the issue is with innerHTML, however I have looked into it deeply and cannot find a plausable resolution. I am adding the news to this site, and I want the news to appear in its own table so I can incooperate many news tables so the frontpage can display more than one days worth of news at a time..I receive an Unknown Runtime Error in IE (however ns,opera,ff,and any gecko platform browsers work fine..)declaration of the xml documents: if (window.ActiveXObject){ try { xml = new ActiveXObject("Msxml2.DomDocument"); xsl = new ActiveXObject("Msxml2.DomDocument"); } catch (e) { alert("If you're using IE 5 or 5.5, you need MSXML 3 SP1 or later"); } try { xml.async = false; xml.load(xmlUrl); xsl.async = false; xsl.load(xslUrl) } catch (e) { alert(e.description) }}else{ if (document.implementation && document.implementation.createDocument) { xml = document.implementation.createDocument("","xml",null); xsl = document.implementation.createDocument("","xsl",null); xml.addEventListener("load", onloadXml, false); xsl.addEventListener("load", onloadXsl, false); xml.load(xmlUrl); xsl.load(xslUrl) } else { alert("Your browser doesn't support XML/XSLT!"); }} here is my div and the innerHTML for the transformation: <head>....function transformContent(){ try { if (document.implementation && document.implementation.createDocument) { processor = new XSLTProcessor(); processor.importStylesheet(xsl) ownerDocument = document.implementation.createDocument("", "test", null); var newDocument = processor.transformToDocument(xml,ownerDocument); document.getElementById("news").innerHTML = new XMLSerializer().serializeToString(newDocument); } else { document.getElementById("news").innerHTML = xml.transformNode(xsl); } } catch (e) { alert(e.description) }}....</head><body>....<div id="news"></div>...</body> xsl file: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template match="/"><xsl:for-each select="news/content"><xsl:sort select="sn"/><table bgcolor="#880101" cellpadding="2" cellspacing="1" height="100%" width="425" align="center"><tbody><tr><td bgcolor="#000000"><b><xsl:value-of select="title"></xsl:value-of> |</b> posted by: <xsl:value-of select="user"></xsl:value-of> on: <xsl:value-of select="date"></xsl:value-of></td></tr><tr><td bgcolor="#000000"><xsl:value-of select="text"></xsl:value-of></td></tr></tbody></table></xsl:for-each></xsl:template></xsl:stylesheet> btw, I have tried news.innerHTML and to no avail the same error occurs. I have tried news.innerText and this will not display the table or its contents.PS. This Does work for any other browsers except for MSIE browsers, and Opera 9.1.any ideas, or commands that I may not have tried or just anything that could be helpful would be great Link to comment Share on other sites More sharing options...
boen_robot Posted January 10, 2007 Share Posted January 10, 2007 No thanks needed. It was nothing... I mean really (scince there wasn't anything new for me in the process ).The XSLT FAQ holds the answer to what you seek and it's the JS from question 3 to be exact. If could solve the issues with that script though, it would be good. Whatever the issue with your version, I can tell you that the one one above works with all browsers, as long as of course the XSLT output is fine (try to use document() and run the HTML in Opera to see what I mean). Link to comment Share on other sites More sharing options...
Kozical Posted January 11, 2007 Author Share Posted January 11, 2007 Well, after three days of trying to make my xslt client-side I found out IE has many issues with innerHTML and tables, so I ended up trying php5 I tried transformToDocument first, but nothing happened, so I tried transformToXMLI just added my HTML source to an .XSL file then did a little debugging of the HTML because of xml's strict source restrictions. and Bam ... (heart drops, tear appears, drips down my cheek) it worked exerpt from msdn's factfile on the innerHTML property: The innerHTML property is valid for both block and inline elements. By definition, elements that do not have both an opening and closing tag cannot have an innerHTML property.The innerHTML property takes a string that specifies a valid combination of text and elements.When the innerHTML property is set, the given string completely replaces the existing content of the object. If the string contains HTML tags, the string is parsed and formatted as it is placed into the document.This property is accessible at run time, as of Microsoft Internet Explorer 5. Removing elements at run time, before the closing tag is parsed, could prevent other areas of the document from rendering.When using innerHTML to insert script, you must include the DEFER attribute in the script element.You can change the value of the title element using the document.title property.To change the contents of the table, tFoot, tHead, and tr elements, use the table object model described in How to Build Tables Dynamically. For example, use the rowIndex property or the rows collection to retrieve a reference to a specific table row. You can add or delete rows using the insertRow and deleteRow methods. To retrieve a reference to a specific cell, use the cellIndex property or the cells collection. You can add or delete rows using the insertCell and deleteCell methods. To change the content of a particular cell, use the innerHTML property.To maintain compatibility with earlier versions of Internet Explorer, this property applies to the textArea object. However, the property works only with strings that do not contain tags. With a string that contains a tag, this property returns an error. It is better to use the innerText property with this object. So in conclusion, if you're in the spot I was in just try a whole new route. I tried php5 with great success so I'd suggest a little research and a whole lot of moxy :)Thanks to boen_robot, he's always willing to help, maybe we both can learn something from this experience. IE sucks ! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now