Re: XSLT and DTD
| Newsgroups | gmane.comp.mozilla.devel.layout.xslt |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
On Apr 10, 10:34 am, "[email protected]" <[email protected]> wrote: > On Apr 10, 9:13 am, Martin Honnen <[email protected]> wrote: > > > [email protected] wrote: > > > Firefox 2,0 does not render it in normal mode > > > I think the URLs you posted so far were to working examples. Can you > > post a URL to an example that does not work as you want it and explain > > in some details what goes wrong in your view? > > > -- > > > Martin Honnen > > http://JavaScript.FAQTs.com/ > > Martin > > Tonight when I get home I will attempt to put the smallest example I > have of it it working and not working. I will post a reply here > providing the urls for both examples. > > Thanks for your interest. > > John Perkins The urls are For quirk mode which works http://arsmc.org/documents/test_wo_dtd.html For standard mode which does not http://arsmc.org/documents/test_w_dtd.html Note: 1) http://arsmc.org/documents/test_w_dtd.html?stop stops the js before the call to transform to the generated xslt output. 2) Both render on Opera 3) test_w_dtd.html and the generated output validate when using XMLSPY 4) The xslt generated does not depend on the xml file for this test so as to keep it simple. 5) The javscript to make it work on IE has been removed so as to keep it simple. Here is the content of the files HTML <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="build_page_test.js" type="text/javascript"></script> </head> <body onload="transform('canobie_series');"> <div>HTML Output</div> </body> </html> <?xsml version="1.0" endocing="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xthml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <title>test</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <script src="build_page_test.js" type="text/javascript"></script> </head> <body onload="transform('canobie_series');"> <div>HTML Output</div> </body> </html> JS var xslhttprequest; var xmlhttprequest; var href; var xslprocessor; var xhtml; function transform(xmlfilename) { var re = /stop$/g; href = document.location.href; if (href.match(re)) { return; } try { xslprocessor = new XSLTProcessor(); xmlhttprequest = new XMLHttpRequest(); xmlhttprequest.onreadystatechange=xmlstate; xmlhttprequest.open('GET', xmlfilename + '.xml', true); xmlhttprequest.send(null); } catch (e) { alert("Problem retrieving data"); } } function xmlstate() { if (xmlhttprequest.readyState==4) { if (xmlhttprequest.status==200 || xmlhttprequest.status==0) { xslhttprequest = new XMLHttpRequest(); xslhttprequest.onreadystatechange=xslstate; xslhttprequest.open('GET', 'build_page_js_test.xsl', true); xslhttprequest.send(null); } else { alert("Problem retrieving xml data " + xmlhttprequest.status) } } } function xslstate() { if (xslhttprequest.readyState==4) { if (xslhttprequest.status==200 || xslhttprequest.status==0) { href = document.location.href; xslprocessor.importStylesheet(xslhttprequest.responseXML); xslprocessor.setParameter(null, "uri", href); xhtml=xslprocessor.transformToFragment(xmlhttprequest.responseXML,document); while (document.hasChildNodes()) { document.removeChild(document.lastChild); } document.appendChild(xhtml); } else { alert("Problem retrieving xsl data " + xslhttprequest.status) } } } XSL <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/ Transform" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output method="xml" version="1.0" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" indent="no"/> <xsl:param name="uri"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Generated Output</title> <script src="build_page.js" type="text/javascript"></script> </head> <body> <div>XSL Output</div> </body> </html> </xsl:template> </xsl:stylesheet>