具有 RFDa 和 XHTML 1.0 过渡支持的 DTD
是否存在同时支持 XHTML 1.0 过渡支持和 RDFa 支持的 W3C 文档类型?
我知道 XHTML+RDFa 1.0 (http://www.w3 .org/MarkUp/DTD/xhtml-rdfa-1.dtd) DTD,但这是 XHTML 1.1,与我当前的网站不兼容。似乎还有一个 HTML4+RDFa 1.0 (http://www .w3.org/MarkUp/DTD/html4-rdfa-1.dtd) DTD 可用。
我不提供 XHTML 1.1 的主要原因当然是 Internet Explorer,尽管如果没有其他方法,我可能可以将它作为 IE 用户的 text/html 提供。
Is there a W3C document type available with both XHTML 1.0 transitional support and RDFa support?
I am aware of the XHTML+RDFa 1.0 (http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd) DTD but that is XHTML 1.1 which is not compatible with my current website. It seems that there is also a HTML4+RDFa 1.0 (http://www.w3.org/MarkUp/DTD/html4-rdfa-1.dtd) DTD available.
My main reason for not serving XHTML 1.1 is Internet Explorer ofcourse, although I could probably serve it as text/html for the IE users if there is no other way.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不相信有这样的 DTD,不。
HTML 变得越来越分散,为每种可能的组合创建 DTD 是不切实际的。 HTML5 不基于 SGML,并且实际上放弃了 DTD。将来,验证器可能必须进行更改,以便它们调用 RDFa 和 ARIA 等组件集合,并在结果中指示需要哪些集合才能允许每个特定的标记部分保持一致。
不幸的是,我们目前正处于过渡点,因此没有干净的解决方案来解决您的问题。然而,一定程度的实用主义会让你走得更远。
现在,XHTML+RDFa 1.0 可能被 DTD 定义为 XHTML 1.1 的扩展,但它实际上不是 XHTML 1.1,也不是 XHTML 1.0 过渡或严格的,或者实际上不是“XHTML+RDFa 1.0”之外的任何东西。
所以你可以采取务实的服务方法。考虑一下 HTML5 对此的态度。它表示,无论您声明任何 DOCTYPE,您用作 text/html 的任何内容都是对象模型的 HTML 序列化。无论如何,这实际上是浏览器所做的。
同样,使用 XML 内容类型(例如 application/xhtml+xml)提供的任何内容都是 XML 序列化。 XML 中具有 xhtml 命名空间的部分构成了 XHTML。
因此,在实践中,只要标记满足多语言文档的要求,您就可以毫无困难地将 XHTML+RDFa 1.0 作为 text/html 或 application/xhtml+xml 提供服务。
这就剩下验证了。撇开 RDFa 不谈,您正在使用的标记是否符合 XHTML 1.0 Transitional 但不符合 XHTML 1.1?如果是这样,您是否足够关心完美验证以更改这些或放弃使用 RDFa?想必您使用 RDFa 是为了您的用户利益,而验证本质上是您自己的便利工具。
最近,当我决定将 ARIA 属性添加到我的 XHTML 1.0 页面时,我遇到了类似的情况。我认为可访问性胜过有效性,并且我会添加属性并忘记确保我的页面 100% 有效。
I don't believe there is such a DTD, no.
HTML is becoming more and more fragmented and creating DTDs for every possible combination is not going to be practical. HTML5 is not SGML based and effectively gives up on DTDs. In future, validators are probably going to have to change so that they call in component collections like RDFa and ARIA, and indicate in their results which collections are required to allow each particular piece of mark-up to be conforming.
Unfortunately, we're really at about the transition point currently, so there's no clean solution to your problem. However, a certain amount of pragmatism will get you a long way.
Now, XHTML+RDFa 1.0 may be defined by DTD as an extension of XHTML 1.1, but it isn't actually XHTML 1.1, nor is it XHTML 1.0 transitional or strict, or indeed anything other than "XHTML+RDFa 1.0".
So you can take a pragmatic serving approach. Consider the HTML5 attitude to this. It says that anything you serve as text/html is an HTML serialization of the object model, regardless of any DOCTYPE that you declare. This is in practice what browsers do anyway.
Similarly, anything you serve with an XML content type such as application/xhtml+xml is an XML serialization. Those parts of the XML that have the xhtml namespace constitute XHTML.
So, in practice, you can serve your XHTML+RDFa 1.0 as text/html or application/xhtml+xml without any difficulty, provided that the mark-up meets the requirements for polyglot documents.
That leaves the validation. Leaving aside RDFa, is there any mark-up that you're using that's conformant XHTML 1.0 Transitional but not conformant XHTML 1.1? If so, do you care enough about perfect validation to either change these, or to back away from using RDFa? Presumably you're using RDFa for your users benefit, while validation is essentially a convenience tool for yourself.
I faced a similar situation recently, when I decided to add ARIA attributes to my XHTML 1.0 pages. I decided that Accessibility trumps Validity, and I would add the attributes and forget about ensuring my pages were 100% valid.
实际上,除非您关心 DTD 实现,否则各种 XHTML 版本之间几乎没有差异,并且几乎没有理由不使用 XHTML 1.1。您的网站以何种方式依赖于1.0过渡?如果您可以使您的站点在 1.0 严格版本下有效,那么从 1.0 迁移到 1.1 应该不会引起问题,因为本质上唯一的区别是模块化 DTD,它实际上没有任何缺点。
如果您仍在与 XHTML MIME 的哲学问题作斗争,我不会担心,因为从概念上讲,使用组织更好的 1.1 DTD 提供错误的媒体类型并不比使用 1.0 更犯罪。 RDFa 按原样实现的原因是因为将 RDFa 模块添加到 XHTML 1.1 DTD 只涉及向主模块添加几行。对 1.0 DTD 执行此操作会更困难且不那么干净。
其他需要考虑的事情是 XHTML 1.1 第二版规范包括 XML 模式实现。此外,最新的 XHTML+RDFa 1.1 工作草案最终放弃了完全指定 doctype 的(愚蠢的)要求,因此您可以使用仅模式验证。如果您能找到一种使用 XML/XHTML mimetype 的方法,那么这将非常有效,因为不需要 doctype 声明即可在支持它的浏览器(除 IE8 及更低版本之外的所有浏览器)上获得标准模式渲染。
In reality unless you are concerned with the DTD implementation there are almost no differences between the various XHTML versions and there's almost never a valid reason not to use XHTML 1.1. In what way is your website dependent upon 1.0 transitional? If you can get your site valid with 1.0 strict then moving from that to 1.1 shouldn't cause problems because essentially the only difference is the modularized DTD, which really has no drawbacks to it.
If you're still struggling with the philosophical problem of XHTML MIME I wouldn't worry because conceptually serving the wrong media type with the better organized 1.1 DTD is no more of a crime than with 1.0. The reason RDFa is implemented as it is is because adding the RDFa module to the XHTML 1.1 DTD only involves adding a few lines to the main module. Doing that to the 1.0 DTD would be harder and not as clean.
Some other things to consider are that the XHTML 1.1 second edition spec includes an XML schema implementation. Also, the latest XHTML+RDFa 1.1 working draft finally drops the (stupid) requirement for specifying a doctype altogether, so you could use schema-only validation. This would work out really well if you can figure out a way to use XML/XHTML mimetypes because no doctype declaration is required in order to get standards mode rendering on browsers which support it (all of them but IE8 and below).