...

View Full Version : XML and CSS



Skyzyx
09-11-2002, 04:29 PM
Using the various XML import scripts I've found here, along with a few other references, I've managed to get my importXML.htm page to work (read http://www.codingforums.com/showthread.php?s=&threadid=4548).

The new issue at hand is that when I save XML data to a JavaScript variable, I can't seem to get CSS style sheets to apply.

For example:


document.write('<table><tr><td style="font-size:8pt;color:#FF0000">'+myJsVariableOfXmlData+'</td></tr></table>');


This doesn't seem to work. I've heard of XSL, but don't really know how it works. Could somebody give me an example of how to do the above task with XSL?

Skyzyx
09-14-2002, 01:56 AM
Nevermind... I've learned XSL, and it's awesome! I am having problems though with Gecko. Although it works just fine with IE, if I design a XSL file for use with an XML file, if I include JavaScript in that XSL file, document.write() doesn't seem to work at all under Mozilla/Netscape. Is this on purpose, or is this a bug?

Alex Vincent
09-14-2002, 07:41 PM
More than likely it's intentional. document.write is a DOM Level 1 HTML method, meaning it's supposed to work with HTML documents. It's also supposed to work with XHTML documents served as text/html or application/xhtml+xml (mime types from the server).

document.write is also a risky idea, compared with the Document Object Model's Core techniques.

Skyzyx
10-04-2002, 07:03 AM
Actually, I contacted Mozilla.org, and yes, it is a bug expected to be fixed by the release of 1.2/1.0.2. Until then, I'll have to use DOM techniques instead of XSL for certain data.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum