Click to See Complete Forum and Search --> : I'm saddened by both FF2 and MSIE 7
Charles
10-27-2006, 06:57 AM
I went through all of the trouble of providing my RSS feeds with XSLT stylesheets so that you could view them in a browser and they would match the site. But now both browsers, in an effort to promote RSS no doubt, display RSS in their own format. They are ignoring the stylesheet.
Woe, such woe.
If only the provided their own stylesheets as a default and let mine overrride then all would be well. But alas...
Charles
02-09-2007, 06:23 PM
I've solved the problem with:<?php
function set_content_type () {
$accept = array();
$headers = array_change_key_case (@apache_request_headers());
if (isset ($headers ['accept'])) {
foreach (explode (',', $headers ['accept']) as $a) {
$b = explode (';q=', $a);
$accept [trim($b[0])] = isset ($b[1]) ? trim($b[1]) : 1;
};
};
$content_type = isset ($accept['application/rss+xml']) && $accept['application/rss+xml'] ? 'application/rss+xml' : 'application/xml';
header("Content-Type: $content_type; charset=iso-8859-1");
};
set_content_type();
?>
drhowarddrfine
02-09-2007, 09:44 PM
Perhaps the fact that this is RSS makes it different but I was just looking at the Mozilla site, today, and they specifically said XML stuff was done with stylesheets and XSLT. It was the link on that other thread you posted to.
Charles
02-10-2007, 02:49 PM
There is another interesting connection between this thread and that other - where we discuss, among other things, the fact that Firefox doesn't resolve external entities. It would be really, really nice if RSS supported the mnemonic entities found in HTML and XHTML. Theoretically they are way easily added to RSS the same way they are added to XHTML, with external entities:<!ENTITY % HTMLlat1 PUBLIC
"-//W3C//ENTITIES Latin 1 for XHTML//EN"
"xhtml-lat1.ent">
%HTMLlat1;
<!ENTITY % HTMLsymbol PUBLIC
"-//W3C//ENTITIES Symbols for XHTML//EN"
"xhtml-symbol.ent">
%HTMLsymbol;
<!ENTITY % HTMLspecial PUBLIC
"-//W3C//ENTITIES Special for XHTML//EN"
"xhtml-special.ent">
%HTMLspecial;Alas, thanks to Firefox I have been reduced to using:<?php
echo "<!DOCTYPE rss [\n";
foreach (glob ('*.ent') as $ent) {
echo "\n";
echo file_get_contents ($ent);
};
echo "]>\n";
?>This, however, greatly increases the size of my feeds.
WebJoel
02-10-2007, 07:21 PM
I was going to re-interate my subtly-benign sentiments about Firefox 2.0.0.2 not being 'as nice' as Firefox 1.5-maybe (but I'm keeping it anyway), and how I recently downloaded IE7 and, after an hour of fiddling with it, got bored and mad at it and un-installed it, reverting back to v6. If I haffta have it, -I prefer IE6 (but IE5.5 was better IMHO)... but upon reading your post & follow-up notes, -I see that I am way outgunned here... (quietly backing out of room...)
Stephen Philbin
02-10-2007, 10:19 PM
It's not a matter about being out-gunned, Joel. Everybody has something to learn from somebody. The more people that join a discussion, the more likely it is that someone else will learn from it.
To give a quick run-down (though I think Charles himself is probably in a better position to clarify the purpose of his own posts), is that for browsers that specifically state RSS as an application of XML as a supported media type, you should serve your feeds or style-sheet for your feeds (the location where you're supposed to use that "set_content_type()" function was less than obvious to me) as "application/rss+xml", but for other regular XML processors, "application/xml" will do.
His second post appears to relate to a strangely over-looked aspect of XML; the extensibility of XML (and any ML derived from it). The ability to include into another ML, that which we take for granted in MLs like HTML and XHTML. Doing so can make pulling data out of your database and chucking it straight into a feed without that thought, that bit less painful.
Though as I said -- Charles is probably best-placed to clarify on the subject matter of his posts so that anyone that has not yet fully studied the XML 1.0 recommendation, or is as yet incapable of comprehending the terminology therein, could learn something useful from his post.
Charles
02-11-2007, 06:39 AM
In the martial art that I practice we address each other with the words "Onegai shimasu" which we translate "Please teach me." Thus we remind each other that we have something to learn from everybody, even from people completely new to the art - often especially from people completely new to the art. And we remind each other of our responsibility to pass on what we have been taught.
Everyone who hasn't read, marked, learned and inwardly digested the HTML 4.01 Specification should stop everything and at least read the section on How to read the HTML DTD (http://www.w3.org/TR/html401/intro/sgmltut.html#h-3.3). (Unless, of course, they already know how to read a DTD.) XML DTDs are a little bit different from SGML DTDs, but just a little.
Regarding the mnemonic entities, " " and "&mdash" and such, while I am extending RSS I'm not really making a new mark up language. And I should point out that you can, in theory, do the same thing in HTML. But that's just one of the many parts of HTML that aren't supported in the real world. XML was supposed to fix this mess by requiring that user agents support all of it or nothing. Firefox's refusal to do so is actually a blow against the whole XML project.
One other feature of XML is that you can have XML applications without a DTD. That's why RSS gets away without one, though you could add one if you like. And you can create your own entities but you have to do it in the DTD. You don't need the full one; a partial one will do. But you do need to specify the root element and your entities:<!DOCTYPE rss [
<!-- Portions (C) International Organization for Standardization 1986
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->
<!ENTITY nbsp " ">
]>Which is fine for just one of them but if you want to have all of them available you might want to put them in a separate file and use:<!DOCTYPE rss [
<!ENTITY % HTMLlat1 SYSTEM "xhtml-lat1.ent">
%HTMLlat1;
]>But we can't do that, thanks to Firefox and I don't want all of that in my source files. So I'm using PHP to build the DOCTYPE that I need. The mnemonic entities come in three files and so I just need to upload the two that I want and let PHP do the rest. That way should I want that third group I can add it easily.
My other example is simply a way to parse the HTTP Accept header to send the file as a "application/rss+xml" where it is clearly requested and "application/xml" every where else. Browsers seem to lump "application/xml" with "*.*".