OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

dita-translation message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Draft proposal for dir attribute

Hi all,

Here's my draft proposal for the dir attribute. I'd appreciate review
feedback via email before Monday's SC meeting so we can try closing this
item on Monday to hand off to the DITA TC.

It's a working draft that I hope will invoke input from the SC members.
Based on feedback I receive, I plan to prepare a closer to final draft
before Monday's meeting.

I think the main questions are:
1. Should dir be a universal attribute or not?
2. Should we support dir="ltr|rtl" or dir="ltr|rtl|lro|rlo" as per HTML 4.0?

Any and all feedback will be greatly appreciated.

Best Regards,

Gershon L Joseph
Member, OASIS DITA and DocBook Technical Committees
Director of Technology and Single Sourcing
Tech-Tav Documentation Ltd.
office: +972-8-974-1569
mobile: +972-57-314-1170
Title: Dir Attribute Proposal

Dir Attribute Proposal

1. Background

While most languages are written in a text from from left to right, Hebrew and many Arabic languages are written from right to left. In some languages, including Hebrew, numbers and other content is written left to right. Also, a multilingual document containing, for example, English and Hebrew, contains some text that flows left to right and other text that flows right to left.

Text direction cannot be sufficiently specified by the xml:lang attribute alone, because numeric and punctuation characters are input, and rendered, according to the current text flow direction (LTR or RTL).

From the HTML 4.0 spec:

The dir attribute specifies the directionality of text: left-to-right (dir="ltr", the default) or right-to-left (dir="rtl"). Characters in Unicode are assigned a directionality, left-to-right or right-to-left, to allow the text to be rendered properly. For example, while English characters are presented left-to-right, Hebrew characters are presented right-to-left. Unicode defines a bidirectional algorithm that must be applied whenever a document contains right-to-left characters. While this algorithm usually gives the proper presentation, some situations leave directionally neutral text and require the dir attribute to specify the base directionality. Text is often directionally neutral when there are multiple embeddings of content with a different directionality. For example, an English sentence that contains a Hebrew phrase that contains an English quotation would require the dir attribute to define the directionality of the Hebrew phrase. The Hebrew phrase, including the English quotation, would be contained within a ph element with dir="rtl".

2. Specification changes

Add a new attribute called "dir", as follows:


This attribute specifies the base direction of the element's text content. This direction overrides the inherent directionality of characters as defined in Unicode Standard Annex #9: The Bidirectional Algorithm. This attribute must be universally available on all elements (add to %univ-atts;?). There are some elements for which dir does not apply, such as:

  • image

  • others?

Should we keep dir universal and document it's not relevant on <image> (less work) or add dir everywhere except where it does not make sense (more work?)

Additional rules to be documented:

  • When the dir attribute is set for a block-level element, it remains in effect for the duration of the element and any nested block-level elements. Setting the dir attribute on a nested element overrides the inherited value.

  • Inline elements, on the other hand, do not inherit the dir attribute. If the inline element has an xml:lang attribute, then the specified language's default text direction is used unless the inline element also specifies the dir attribute, which overrides any implied direction inferred by xml:lang. If the inline element does not specify the xml:lang attribute, the directionality is inferred from the default direction of the inherited xml:lang value. (This rule is my interpretation of the XHTML recommendation for the dir attribute.)

  • If the document element does not specify the dir attribute, assume left to right (ltr).

  • To set the base text direction for an entire document, set the dir attribute on the topic (or equivalent specialized) element.

  • The dir attribute can also be used to specify the direction of non-textual content, such as tables and lists. In the case of <table dir="rtl">, the columns flow from right to left. In the case of <ul dir="rtl"> or <ol dir="rtl">, the list decoration (bullets or numbers) appear on the right of the screen/page and the <li> content flows from right to left.


<p dir="ltr">
The Hebrew word for "Hebrew" is <ph xml:lang="he-il">עברית</ph>,
but since Hebrew letters have intrinsic right-to-left directionality,
I had to type the word starting from the letter "ע",
i.e. <ph xml:lang="he-il" dir="ltr">עברית</ph>.

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]