Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > css question

Reply
Thread Tools

css question

 
 
Michael Hamm
Guest
Posts: n/a
 
      10-13-2004
I'd appreciate any help anyone could provide in this matter.

Please see http://math.wustl.edu/~msh210/rss.xml . There's an <em>
element in there, which should, by my reckoning, show up italicized in my
Web browser (IE6), but doesn't. I assume that I did something wrong
(although problems with IE are, in general, not unheard-of); can someone
please tell me what it is I did wrong?

Some more info (which you can figure out yourself by reading the
documents): rss.xml calls http://math.wustl.edu/~msh210/rss.xsl which, in
turn, has a <link rel="stylesheet"/> element (which my UA uses) and a
<style> element (which my UA does not seem to use: it's the <style>
element that says <em>s should be italicized).

As I say, I'd appreciate any help.

Michael Hamm
AM, Math, Wash. U. St. Louis
Standard disclaimers:
http://math.wustl.edu/~msh210/ ... legal.html
 
Reply With Quote
 
 
 
 
Joris Gillis
Guest
Posts: n/a
 
      10-13-2004
Hi,

The problem here is the '<xsl:value-of select="description" />': it
returns the concatenation of all text descendants of the 'description
node'. All other nodes like 'em' are ignored.
You could use '<xsl:copy-of select="description" />' to copy all nodes
including 'em'.
(or you could use '<xsl:apply-templates/>')

Also note that you're not generating html.
You don't specify the output type and the generated document itself is not
valid (X)html.
In this case the behaviour of a browser is not defined, so it is not
unlikely to see css rules not being applied.

the stylesheet looks like this

<?xml version="1.0" ?>
<xsl:stylesheet version="1.0"
xmlnssl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="html"/>

<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" href="basic.css" type="text/css" />
<style type="text/css">
em{font-style:italic}
em em{font-style:normal}
em em em{font-style:italic}
strong{font-weight:bolder}
</style>
</head>
<body>
<xsl:apply-templates select="//rss/channel"/>
</body></html>
</xsl:template>


<xsl:template match="channel">

<title><xsl:value-of select="title" /></title>
<h1><xsl:value-of select="title" /></h1>
<p><xsl:value-of select="description" /></p>
<xsl:for-each select="item">
<div>
<h2><xsl:value-of select="title" /></h2>
<address><xsl:value-of select="pubDate" /></address>
<p><xsl:copy-of select="description"/></p>
</div>
</xsl:for-each>
<address><a><xsl:attribute name="href"><xsl:value-of select="link" />
</xsl:attribute><xsl:value-of select="copyright" /></a></address>
</xsl:template></xsl:stylesheet>


regards,

--
Joris Gillis (http://www.ticalc.org/cgi-bin/acct-v...i?userid=38041)
Ceterum censeo XML omnibus esse utendum
 
Reply With Quote
 
 
 
 
Andy Dingley
Guest
Posts: n/a
 
      10-13-2004
On Wed, 13 Oct 2004 19:14:52 +0000 (UTC),
(Michael Hamm) wrote:

>There's an <em> element in there,


There is indeed. There isn't an <em> in RSS.

I suggest reading this
http://diveintomark.org/archives/200...compatible-rss
 
Reply With Quote
 
Michael Hamm
Guest
Posts: n/a
 
      10-14-2004
On Wed, 13 Oct 2004 22:45:41 +0100, Andy Dingley <>
wrote, in part:
> > There's an <em> element in there,

>
> There is indeed. There isn't an <em> in RSS.


I didn't refer to any DTD, so there's an anything-I-want in RSS. As long
as I tell the UA what to do (which I thought I did, using CSS), that
should suffice, no?

> I suggest reading this
> http://diveintomark.org/archives/200...compatible-rss


I read it (not very carefully. That is, I read through all the text, but
not all the examples, and none of the external citations). I fail to see
its relevance.

Michael Hamm
AM, Math, Wash. U. St. Louis
Standard disclaimers:
http://math.wustl.edu/~msh210/ ... legal.html
 
Reply With Quote
 
Michael Hamm
Guest
Posts: n/a
 
      10-14-2004
On Wed, 13 Oct 2004 19:47:26 GMT, Joris Gillis <> wrote, in
part:
> The problem here is the '<xsl:value-of select="description" />': it
> returns the concatenation of all text descendants of the 'description
> node'. All other nodes like 'em' are ignored.
> You could use '<xsl:copy-of select="description" />' to copy all nodes
> including 'em'.


Thanks very much; I've fixed it per your suggestion (this first one that I
quoted), and all seems well.

> Also note that you're not generating html.
> You don't specify the output type and the generated document itself is
> not valid (X)html.
> In this case the behaviour of a browser is not defined, so it is not
> unlikely to see css rules not being applied.


Every browser under the sun knows what to do with a page that looks like
<title>foo</title><h1>bar</h1><p>baz</p>
which is what I generate. The only problem, I guess, is that I don't
specify a MIME type for the generated page. (Browsers faced with
<title>foo</title><h1>bar</h1><p>baz</p>
in a page served with MIME type text/plain will generally not display it
as an HTML page.) So perhaps I'd better, as you suggest, use
> <xslutput method="html"/>


Thanks again for your help.

Michael Hamm
AM, Math, Wash. U. St. Louis
Standard disclaimers:
http://math.wustl.edu/~msh210/ ... legal.html
 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      10-14-2004
On Thu, 14 Oct 2004 13:17:11 +0000 (UTC),
(Michael Hamm) wrote:

>> There is indeed. There isn't an <em> in RSS.

>
>I didn't refer to any DTD, so there's an anything-I-want in RSS.


No there isn't. There might be, but then it stops being valid RSS.

>As long
>as I tell the UA what to do (which I thought I did, using CSS), that
>should suffice, no?


As Joris has already said, then the "simple" problem was evaluating
<description> as text, not as a node-set.

As a general rule, it's (sadly) not practical to process RSS with pure
XSLT - or at least not to process embedded HTML markup in RSS with it.
Using <xsl:value-of select="description" /> isn't a bad idea really -
it's limited, but it's often the best you can achieve.

>> I suggest reading this
>> http://diveintomark.org/archives/200...compatible-rss


RSS is riven with problems, version incompatibilities and
contradictory specifications. Mny of these are centred on how to
represent embedded HTML markup. The reference is one of the clearest
summaries of this sorry mess.

You can't generate RSS by blindly embedding chunks of literal HTML
into it, as your example did. If you try it, your code will barf when
it receives &eacute; or <br> (and a few others). If you're generating
it yourself, then you might be able to limit the content to a balanced
XML fragment (as your example was) which is rather more workable.
This might even work for you, but don't fool yourself that it's valid
RSS, or that other consumers will be happy to accept it.

--
Smert' spamionam
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: correction: A question about css (was: A question about css) richard HTML 12 03-09-2010 08:52 PM
Is this the newsgroup for CSS help? CSS Question Included AF HTML 17 08-09-2006 06:57 PM
CSS question - can I make CSS Cascade sideways? Bill_W_Stephens@yahoo.com HTML 6 03-18-2006 06:02 PM
CSS Layout question - how to duplicate a table layout with CSS Eric ASP .Net 4 12-24-2004 04:54 PM
print.css and screen.css tom watson HTML 1 09-09-2003 02:48 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57