[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: XSL-List Digest V4 #1026
Date: Wed, 22 Jan 2003 12:09:05 +0200 From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx> Subject: Re: XML->XSLT->HTML->CSS Shawn O. McKenzie wrote: I am attempting to take XML files and dynamically convert to HTML with XSLT in the browser (no problem there). During the transform to HTML I throw in a reference to a CSS file. It seems that IE has no problem with this, but Netscape/Mozilla do not seem to apply the CSS. I have found a discussion on my exact problem at: http://bugzilla.mozilla.org/show_bug.cgi?id=145684 However, I am still having problems getting it to work. Having not done much CSS, I'm sure I am doing something wrong. Here are the bits of my XSLT that should be relevant. <?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/"> <html> <head> <link href="sample.css" rel="stylesheet" type="text/css" media="all/print/screen"></link> </head> Then, the part I have been trying to make work with CSS as a test case looks like this: <p class="syntax"><b>property </b> <xsl:value-of select="$prop"/><xsl:value-of select="$arrayparams"/>: <xsl:value-of select="$type"/> <xsl:if test="syntax/read != ''"> <b> read </b><xsl:value-of select="syntax/read"/> </xsl:if> <xsl:if test="syntax/write != ''"> <b> write </b><xsl:value-of select="syntax/write"/> </xsl:if>; </p> And, just to test things, I have added the following to sample.css p.syntax { color : green; font : Courier; } I know it is loading the .css file because if I choose View | Page Info it is listed both under the Links tab as a stylesheet and the Privacy tab as an externally loaded document. One quote in the discussions on bugzilla relating to someone having a similar problem is "The source XML doesn't specify a namespace, so things like the style="" attributes won't be treated as you expect because the browser doesn't assume it's dealing with HTML." But, I thought that is what the xsl:output tag did... XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|