html:title in pure XML document
I decided to use pure XML+CSS instead of (X)HTML for my webpage. I use and with no problems. However I can't specify webpage's title.
Document looks like this:
<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="style.css"?>
<html:html xmlns:html="http://www.w3.org/1999/xhtml">开发者_开发技巧;
<html:head>
<html:title>FooBar</html:title>
</html:head>
<site>
<header>foo</header>
<article>
<title>foo</title>
<p>foo bar <html:a href="#">foobar</html:a></p>
</article>
</site>
</html:html>
But it doesn't work.
Update: it works on Chrome and Internet Explorer. Doesn't work on Firefox.
Why don't you leave xhtml as it is and use another namespace with an alias for your custom tags?
Edit
I mean something like:-
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:a="urn:mycrop.com:mystuff">
<head>
<title>FooBar</title>
</head>
<a:site>
<a:header>foo</a:header>
<a:article>
<a:title>foo</a:title>
<p>foo bar <a href="#">foobar</a></p>
</a:article>
</a:site>
</html>
Of course this will fail if the browser strictly expects XHTML but that was true of your originally anyway.
From your comments elsewhere in this question it looks like you've gone for XSLT as a stylesheet anyway. That being the case you needn't bother with including any of the HTML stuff anyway, just have the source XML contain the data you want to display.
OK, I used XSLT to do this. Works like a charm on every browser.
精彩评论