Subject: Atom bidi attribute, empty string value

From: James M Snell <[email-masked]>
Date: Tue, 08 May 2007 17:24:36 -0700

In an offline note, Franklin Tse asked about the empty string value for
the bidi attribute.  He had raised an issue before about whether that
could be dropped, which I had originally decided to go ahead and do.
However, after going through a number of aggregated feed scenarios,
having the ability to explicitly state that no default direction had
been specified seemed to be more important than relying on a default
direction of LTR.  I can definitely be convinced otherwise, of course.

- James

---

From: "Franklin Tse" <[email-masked]>
Date: Wed, 9 May 2007 17:10:04 +0800

Um...

When an aggregator uses the empty "dir" attribute in an entry of an aggregated feed, it is actually asking another Atom processor to decide the text direction of that entry. Feed readers that read the aggregated feed may have difficulty in processing the entry, for example:

<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="he" dir="rtl">
  <!-- The base text direction of this containing element is right-to-left as specified in the "dir" attribute -->
  <title>...</title>
  ...
  <entry xml:lang="en" dir="ltr">
    <!-- The base text direction of this containing element is changed to left-to-right as specified in the "dir" attribute -->
    <title>...</title>
    ...
  </entry>
  <entry dir="">
    <!-- The base text direction of this containing element is reset -->
    <title>...</title>
    ...
  </entry>
</feed>

For the second entry, what should feed readers do? They should of course apply the default of the "dir" attribute, but what is the default value of the "dir" attribute? it is currently not specified in the draft. In addition, should they apply the direction guessing mechanism if they support it? The entry's base language is currently "he", inherited from atom:feed.

However, in the draft:

   For compatibility with existing Atom documents that rely on direction
   guessing, user agents MAY perform direction guessing in documents
   that do not contain a "dir" attribute but they SHOULD NOT do so when
   a "dir" attribute is provided.

When an Atom document contain a "dir" attribute, Atom processors should not apply any direction guessing mechanism. If that is the case, does an empty string mean that direction guessing can be used?

As mentioned above, the default value of the "dir" attribute is not specified. I think the default can either be "ltr" or implementation-dependent (http://www.w3.org/TR/xslt20/#dt-implementation-dependent). But whatever it is, the default should be mentioned.

Franklin

PS: In the example above, if the second entry comes from a source feed that does not contain any "xml:lang" attribute or "dir", aggregators have to generate xml:lang=""[1][2] and dir="" together. (<entry xml:lang="" dir=""></entry>). It is very problematic if only dir="" is generated.

References:
1. http://tools.ietf.org/html/rfc4647#section-3.4.1
2. http://www.w3.org/TR/xml/#sec-lang-tag

---

From: James M Snell <[email-masked]>
Date: Wed, 09 May 2007 08:39:07 -0700

> When an aggregator uses the empty "dir" attribute in an entry of an aggregated feed, it is actually asking another Atom processor to decide the text direction of that entry. Feed readers that read…

Yes.. but they're not asking those processors to do anything more than
what is currently already required.

> [snip]

This is a spec bug.  I had meant to change that to:

  ... user agents MAY perform direction guessing in documents where the
  base direction is unspecified but they SHOULD NOT do so when a "dir"
  attribute value of "ltr" or "rtl" is provided.

This will allow user agents to apply whatever heuristics it wants to
determine the base directionality where the dir is unspecified.

I will fix this in another iteration.

> [snip]

Yep. Not sure if this needs to be discussed in this doc, however.

- James

---

From: "Franklin Tse" <[email-masked]>
Date: Thu, 10 May 2007 00:11:42 +0800

> what is currently already required.

If developers of aggregators want to use dir="", I will be fine. But the use of dir="" in normal feed should be strongly discouraged... feed authors should specify the text direction...

> I will fix this in another iteration.

"in elements" may be better than "in documents" if direction guessing is allowed when dir="" is used in an element and inherited.

> Yep. Not sure if this needs to be discussed in this doc, however.

Um... if your draft has a section called "Relation with the xml:lang attribute", then that should be discussed.

By the way, dir="default" or dir="unknown" seems clearer than dir="".

Franklin

---

From: James M Snell <[email-masked]>
Date: Wed, 09 May 2007 09:41:32 -0700

> If developers of aggregators want to use dir="", I will be fine. But the use of dir="" in normal feed should be strongly discouraged... feed authors should specify the text direction...

Good point. I can add some language discouraging the use of dir="" by
content publishers.

> "in elements" may be better than "in documents" if direction guessing is allowed when dir="" is used in an element and inherited.

+1

> Um... if your draft has a section called "Relation with the xml:lang attribute", then that should be discussed.

There is no such section currently.

> By the way, dir="default" or dir="unknown" seems clearer than dir="".

Clearer yes, but the empty string is more consistent with existing
xml:lang and xmlns conventions.

- James