html:纯XML文档中的标题

时间:2010-01-10 16:05:17

标签: html xml

我决定在我的网页上使用纯XML + CSS代替(X)HTML。 我使用并没有任何问题。 但是我无法指定网页的标题。

文档如下所示:

<?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>

但它不起作用。

更新:适用于Chrome和Internet Explorer。不适用于Firefox。

2 个答案:

答案 0 :(得分:2)

为什么不按原样保留xhtml并使用另一个带有自定义标记别名的命名空间?

修改

我的意思是: -

<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>

当然,如果浏览器严格要求XHTML,那么这将失败,但无论如何都是如此。

从你在这个问题的其他地方的评论来看,无论如何你已经把XSLT作为样式表了。在这种情况下,您无需担心包含任何HTML内容,只需让源XML包含您想要显示的数据。

答案 1 :(得分:0)

好的,我使用XSLT来做到这一点。在每个浏览器上都像魅力一样。