Re: [ACTION 107] Locale Filter

Here's a second take on locale filter. Felix recommended using
a language range from RFC 4647. In fact, we want a priority
list of language ranges. RFC 4647 does not define the syntax
for these, but it defines semantics. [Section 2.3] It uses
a comma-separated list as an example syntax. I used that.

http://tools.ietf.org/html/rfc4647

Also, I've decided to use basic language ranges rather than
extended language ranges. [Sections 2.1, 2.2, 3.3.1, 3.3.2]
Basic ranges either match exactly or match initial substrings
with a hyphen. You can use '*' to mean "anything", but you
can't use it as a subtag, e.g. '*-CH'. If you want to filter
for a region, you'll have to enumerate the languages, e.g.
'de-CH, fr-CH, it-CH'.

I chose basic filtering because I think the algorithm for
extended filtering is tricky (but not impossible) to do in
XSLT 1.0, at least without EXSLT. Basic filtering is easy.
If anybody feels strongly that we should use extended
filtering, speak up. I'm not really opposed.

If there's no objections, I'll put together some examples
and add this to the ODD file.


= Locale Filter

== Definition

The Locale Filter data category specifies that a node is only
applicable to certain locales, or that it is not applicable
to certain locales.

This data category can be used for several purposes, including,
but not limited to:

 * Include a legal notice only in locales for certain regions.
 * Drop editorial notes from all localized output.

The Locale Filter data category associates with each selected
node a filter type and a language priority list conforming to
RFC 4647. The language priority list is a comma-separated list
of basic language ranges. Whitespace surrounding language ranges
is ignored.

The locale filter type can take the following values:


 * "all": The node is included in all locales.
 * "none": The node is included in no locales.
 * "include": The node is only included in locales that match
   at least one language range in the language priority list
   using basic filtering.
 * "exclude": The node is included in all locales except those
   that match at least one language range in the language priority
   list using basic filtering.


If the locale filter type is "all" or "none", a language priority
list SHOULD NOT be provided. If one is, it MUST be ignored. If the
locale filter type is "include" or "exclude", a language priority
list SHOULD be provided. If one is not, it MUST default to the
empty list.

== Implementation

The Locale Filter data category can be expressed with global
rules, or locally on an individual element. The information
applies to the textual content of the element, including child
elements and attributes. The default is that the locale filter
type is "all".

Implementations MUST NOT combine language priority lists from
multiple rules or local attributes.

GLOBAL: The localeFilterRule element contains the following:

 * A required selector attribute. It contains an XPath expression
   which selects the nodes to which this rule applies.

 * A required localeFilterType attribute with the value "all",
   "none", "include", or "exclude".

 * An optional localeFilterList attribute with a comma-separated
   language priority list.

LOCAL: The following local markup is available for the Locale
Filter data category:

 * A localeFilterType attribute with the value "all", "none",
   "include", or "exclude".

 * A localFilterList attribute with a comma-separated language
   priority list.

Received on Monday, 16 July 2012 21:49:55 UTC