Forum Moderators: open
<link rel="StyleSheet" href="main.css" type="text/css" />
<link rel="StyleSheet" href="nn4_layout.css" type="text/css" />
<style type="text/css">
/*<![CDATA[*/
@import url(real_layout.css);
/*]]>*/
</style>
The two lines in C-style comments mystify me, clearly they "work" (the converted code validates) but what do they mean?
Thanks, I hope to update you on the conversion saga later today!
But the concept of CDATA is meaningless in CSS (as in HTML). Thus, to preserve operability when this XHTML file is viewed as HTML and when it is processed as XML, the opening (<![CDATA[) and closing (]]>) tags are "hidden" inside CSS comments.
Similarly, an inline Javascript would be marked up as
<script type="text/javascript">
//<![CDATA[
... script here ...
//]]>
</script>
The necessity of adding these commented CDATA tags is an additional reason why scripts and stylesheets should be externalized as much as possible in XHTML.
[edited by: choster at 2:52 pm (utc) on Mar. 16, 2004]
Just for fun, I want to make my xhtml pages "real" on my workstation (not on the server!) by serving them as application/xhtml+xml. Easy enough to do this with:
Works fine with NN7.1. But when I go to validate I am told that there is no encoding, in spite of:<meta http-equiv="Content-Type" content="application/xhtml+xml" />
This is lifted from the code given on w3c.org under Strictly Conforming Documents [w3.org]. Once I tell the validator what encoding I have used it finds no errors, so I am assuming that the syntax of my XML declaration is correct (or is it?).
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
Almost certainly a very basic mistake; I am still struggling to understand what is going on!