473,320 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

css question

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
ms****@math.wustl.edu Standard disclaimers:
http://math.wustl.edu/~msh210/ ... legal.html
Jul 20 '05 #1
5 1241
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"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output 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
Jul 20 '05 #2
On Wed, 13 Oct 2004 19:14:52 +0000 (UTC), mh***@artsci.wustl.edu
(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
Jul 20 '05 #3
On Wed, 13 Oct 2004 22:45:41 +0100, Andy Dingley <di*****@codesmiths.com>
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
ms****@math.wustl.edu Standard disclaimers:
http://math.wustl.edu/~msh210/ ... legal.html
Jul 20 '05 #4
On Wed, 13 Oct 2004 19:47:26 GMT, Joris Gillis <ro**@pandora.be> 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 <xsl:output method="html"/>


Thanks again for your help.

Michael Hamm
AM, Math, Wash. U. St. Louis
ms****@math.wustl.edu Standard disclaimers:
http://math.wustl.edu/~msh210/ ... legal.html
Jul 20 '05 #5
On Thu, 14 Oct 2004 13:17:11 +0000 (UTC), mh***@artsci.wustl.edu
(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
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
3
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
53
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
56
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
2
by: Allan Ebdrup | last post by:
Hi, I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix question is a question where you have several options that can all be rated according to several possible ratings (from...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.