@dir
attributeThe @dir
attribute provides instructions to
processors about how bi-directional text should be rendered.
Bi-directional text is text that contains text in both text directionalities, right-to-left (RTL) and left-to-right (LTR). For example, languages such as Arabic, Hebrew, Farsi, Urdu, and Yiddish have text written from right-to-left; however, numerics and embedded sections of Western language text are written from left to right. Some multilingual documents also contain a mixture of text segments in two directions.
@xml:lang
@dir
In general, properly-written mixed text does not need any special markers; the Unicode bidirectional algorithm positions the punctuation correctly for a given language. The processor is responsible for displaying the text properly. However, some rendering systems might need directions for displaying bidirectional text, such as Arabic, properly. For example, Apache FOP might not render Arabic properly unless the left-to-right and right-to-left indicators are used.
The use of the @dir
attribute and the Unicode algorithm is explained in the
article Specifying the direction of text and tables: the dir
attribute (http://www.w3.org/TR/html4/struct/dirlang.html#h-8.2) . This article
contains several examples of how to use the @dir
attribute set to either
"ltr" or "rtl". There is no example of setting the @dir
attribute to either
"lro" or "rlo", although it can be inferred from the example that uses the
<bdo>
element, a now-deprecated W3C mechanism for overriding the
entire Unicode bidirectional algorithm.
The @dir
attribute, together with the @xml:lang
attribute,
is essential for rendering table columns and definition lists in the proper order.
@xml:lang
attribute together with the @dir
attribute,
provides for various levels of bidirectionality:@xml:lang
attribute in combination with the @dir
attribute on the highest level
element (topic or derived peer for topics, map for ditamaps) or assumed by the
processing application. If used, the
@dir
attribute SHOULD be specified on the highest level element in the topic or document
element of the map. @dir
attribute
is set to "ltr" or "rtl" as needed, to ensure that the desired direction is applied to
the characters that have neutral bidirectionality. The "ltr" and "rtl" values override
only the neutral characters (for example, spaces and punctuation), not all Unicode
characters. For most authoring needs, the "ltr" and "rtl" values are sufficient. Use the override values only when you cannot achieve the desired effect using the the "ltr" and "rtl" values.
Applications that process DITA documents, whether at the authoring, translation, publishing, or any other stage, SHOULD fully support the Unicode bidirectional algorithm to correctly implement the script and directionality for each language that is used in the document.
Applications SHOULD ensure that the
root element in every topic document and the root element in the root map has values for the
@dir
and @xml:lang
attributes.