Does XML officially support a “dir” or “xml:dir” attribute?

我们两清 提交于 2021-02-10 05:38:11

问题


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

Is there an equivalent attribute for XML? Is the only solution to include Unicode RIGHT-TO-LEFT mark in every text node?


回答1:


The W3C XML Recommendation itself does not address directionality (although it does address language identification as you mention with xml:lang).

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.



来源:https://stackoverflow.com/questions/38995517/does-xml-officially-support-a-dir-or-xmldir-attribute

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!