Re: [xsl] Re: XSL-List Digest V4 #1026

Subject: Re: [xsl] Re: XSL-List Digest V4 #1026
From: S Woodside <sbwoodside@xxxxxxxxx>
Date: Wed, 22 Jan 2003 17:59:35 -0500

On Wednesday, January 22, 2003, at 04:30 PM, Shawn O. McKenzie wrote:


Date: Wed, 22 Jan 2003 12:09:05 +0200
From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx>
Subject: Re: [xsl] 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.

There was old bug with it in mozilla, something with embedded css stylesheets, but I believe it's fixed a long time ago. Show us how do you "throw in a reference to a CSS file".

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>

This is wrong, media should be comma separated, and all already includes print and screen, so take those out. also you can close it simply by doing it this way:
<link href="sample.css" rel="stylesheet" type="text/css" media="all" />



</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;
}

easier test would be something like body { background-color: #F00; }


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...

The bug was closed as invalid and it looks like the reporter corrected the problem by changing the output to html.


simon



XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list


---
     anti-spam: do not post this address publicly
www.simonwoodside.com -- 99% Devil, 1% Angel


XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list



Current Thread