Trouble Getting Declared Namespaces To Work
Solution 1:
In your XHTML:
Your markup is not well-formed:
Your XML declaration should come first, then your doctype declaration:
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE htmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Some of your
<link />
tags aren't closed properly, they should be:<link rel="stylesheet" href="movies.css"type="text/css" /> <link rel="stylesheet" href="actors.css"type="text/css" />
Your page must be served as
application/xhtml+xml
by the server. Typical servers don't know that you're serving XHTML, so they send them astext/html
instead. Browsers won't be able to treattext/html
files as XML, so they won't apply CSS to your custom XML elements.If you work with PHP, it's simply a matter of adding this to the very top of your XHTML file:
<?php header('Content-Type: application/xhtml+xml'); ?>
Or in ASP, add this:
<% Response.ContentType = "application/xhtml+xml"; %>
You should also have an accompanying meta tag, but it's not necessary for your page to validate, and browsers ignore it anyway:
<metahttp-equiv="Content-Type"content="application/xhtml+xml; charset=utf-8" />
You can find a short history lesson on UAs treating XHTML as HTML tag soup in this answer to better understand this.
In your CSS:
It's
font-weight: bold
, notfont-style: bold
.It's
font-style: italic
, notfont-style: italics
.Make sure that your
@namespace
statements are placed at the beginning of your stylesheets. From the spec:Any
@namespace
rules must follow all @charset and @import rules and precede all other non-ignored at-rules and rule sets in a style sheet.
But with all that said, why aren't you placing your actors and movies into their own XML files, then transforming them using XSLT into familiar, actual XHTML?
Post a Comment for "Trouble Getting Declared Namespaces To Work"