Jump to content

Kozical

Members
  • Posts

    5
  • Joined

  • Last visited

Kozical's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. 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 !
  2. 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
  3. Kozical

    XML Editing

    Thanks again boen_robot, you definitely live up to the title XSLT Senior :-)I cannot as of yet test the code because I have php 4 installed on my webserver but, I'm sure you wouldn't steer me wrong with your suggestions. Thank you.
  4. Kozical

    XML Editing

    Thanks, I tried it, it dynamically adds the node. It doesn't change the xml file, I'm guessing that there is some sort of save function to write it back into the file? I tried to post the document to php then save with php but it didn't work out.
  5. Kozical

    XML Editing

    Hi, I'm rather new to the XML world yet not entirely new to the world of coding. I've learned a tremendous amount about XML in the past few days. I still however cannot find much, if anything, about writing to an XML file. I can do this with ASP although my current host does not support ASP because they run FreeBSD, and it costs double the money I pay now to have it switched to Windows. I need to know if there is a way to write (append or insert) a node to an XML file. Say I want to make a message board for example and a cpanel. I need to be able to add and delete from the XML file so it keeps a current record of threads.(this is my crude example of adding to an xml file) <forum> <category name="PHP"> <post name="HELP ME"> <entry name="0001"> <author>Bob</author> <class>newbie</class> <posts>1</posts> <timeof>13:00GMT</timeof> <text>I need help making my php work </text> </entry> <entry name="0002"> <author>John</author> <class>Admin</class> <posts>1056</posts> <timeof>13:01GMT</timeof> <text>Please explain a bit better..</text> </entry> </post>( I want to add another entry here, and have the possibility of removing just that entry, "asin to move it to another category or just remove it from the forum altogether" ) </category> <category name="Private"> </category></forum> Is this a possibility with any other language except ASP?, I tried to make it work with perl, and php seems like it would take me writing an entire class/function set to get it to work properly. I've seen all sorts of (appendChild,removeChild) commands that look like they would work for this although I have yet to see any such commands in action in a formal tutorial or some sort of coding example in any such place. I would greatly appreciate any efforts or intriguing answers you may have.
×
×
  • Create New...