XML 是否正式支持“目录"?或“xml:dir"属性? [英] Does XML officially support a "dir" or "xml:dir" attribute?
问题描述
你可以找到各种文档,说要指定一个 XML 文档内容的语言,使用 xml:lang
,像这样:
You can find various documents that say to specify the language of the content of an XML document, use xml:lang
, like this:
<foobar xml:lang="en">...</foobar>
HTML 和 XHTML 具有属性 dir
可让您指定文本应默认为从左到右,或默认为从右到左:
HTML and XHTML has the attribute dir
that lets you specify that the text should be considered left-to-right by default, or right-to-left by default:
<html dir="rtl">...</html>
是否有 XML 的等效属性?在每个文本节点中包含 Unicode RIGHT-TO-LEFT 标记是唯一的解决方案吗?
Is there an equivalent attribute for XML? Is the only solution to include Unicode RIGHT-TO-LEFT mark in every text node?
推荐答案
W3C XML Recommendation 本身并没有解决方向性问题(尽管它确实解决了语言识别 正如您在 xml:lang
中提到的那样).
The W3C XML Recommendation itself does not address directionality (although it does address language identification as you mention with xml:lang
).
但是,在 XML 国际化的 W3C 最佳实践中,请参阅最佳实践 2:定义标记以指定文本方向 了解如何使用 its:dir
属性和 its:dirRule
元素通过国际化标签集.
However, in the W3C Best Practices for XML Internationalization, see Best Practice 2: Defining markup to specify text direction for how to use the its:dir
attribute and its:dirRule
element to specify directional markup via the Internationalization Tag Set.
这篇关于XML 是否正式支持“目录"?或“xml:dir"属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!