New ITS syntax

Hi all,

This is a RELAX NG schema and a DTD below on the new syntax of ITS.
could you have a look and comment? I am sure there are still errors in
it, so please give a lot of feedback.

Cheers,

Felix



start = element documentRules { ns*, documentRule+ } | itsLocal

ns = element ns { attribute prefix { xsd:NCName }, attribute uri {
xsd:anyURI } }

selector = attribute selector { text }

documentRule = translateRule | locInfoRule | dirRule | termRule |
langRule | localeRule | rubyRule | withinTextRule

translateRule = element translateRule { selector, attribute translate {
"yes" | "no" } }

#About locInfoRule: At the locInfoRule element, there must be either an
locInfo attribute or an locInfoRef attribute. If none is present, there
must be an locInfoMap attribute. It is an error if there is a locInfoMap
attribute and in addition a locInfo or locInfoRef attribute. There is an
optional locInfoType attribute.

locInfoRule = element locInfoRule { selector, attribute locInfo { text
}?, attribute locInfoRef { xsd:anyURI }?, attribute locInfoMap { text
}?, attribute locInfoType { "alert" | "description" }? }

dirRule = element dirRule { selector, attribute dir { "ltr" | "rtl" |
"lro" | "rlo" } }

#About termRule: In an instance document, we would need an attribute
term="yes" to indicate a term. In the global rule, "being" a term is
expressed via the name of the element termRule, hence the attribute
term="yes" is not necessary any more. The attributes termRef and
termRefMap are alternatives. It is an error if they occur at the same
termRule element.

termRule = element termRule { selector, attribute termRef { xsd:anyURI
}?, attribute termRefMap { text } }

#About langRule: The element langRule is used to express that a given
piece of content (selected by the attribute langMap) is used to express
language information as defined by RFC 3066 or its successor. Example:
<its:langRule its:selector="//p" its:langMap="@mylangattribute"/>
expresses that all p elements have a language value conformant to RFC
3066 or its successor. The value is given by the @mylangattribute
attached to the p elements.
langRule = element langRule { selector, attribute langMap { text } }

#Ablut localeRule: The element localeRule is used to express that a
given piece of content (selected by the attribute localeMap) is used to
express locale information. Example: <its:localeRule its:selector="//p"
its:langMap="@mylocaleattribute"/> expresses that all p elements have a
locale value given by the @mylangattribute, which is attached to the p
elements. The value of @mylocaleattribute might be compliant to RFC 3066
bis, but this is not mandatory.
localeRule = element localeRule { selector, attribute localeMap { text } }

#About rubyRule: The element rubyRule is used {1) to map existing ruby
markup to ITS ruby, which itself is defind in terms of the W3C ruby
specification, or (2) to add ruby text to attribute values. Example for
(1): <its:rubyRule its:selector="//span[class='ruby']"
its:rubyBaseMap="span[class='rubyBase']"
its:rubyTextMap="span[class='rubyText']"/> . Example for (2):
<its:rubyRule its:selector="/body/img[1]/@alt" its:rubyBaseMap="."
its:rubyText="World Wide Web Consortium"/> . It is an error if both an
its:rubyText attribute and an its:rubyTextMap attribute occur at the
same <its:rubyRule> element.
rubyRule = element rubyRule { selector, attribute rubyMap { text }?,
attribute rubyBaseMap { text }?, attribute rubyTextMap { text }?,
attribute rubyText { text }? }

#withinTextRule is based on Yves / AZ proposal, see
http://www.w3.org/Bugs/Public/show_bug.cgi?id=2878
withinTextRule = element withinTextRule { selector }

#locale usage of ITS are itsLocalAttributes, or ruby
itsLocal = element span { itsLocalAttributes, text } | rubyLocal

itsLocalAttributes = translateLocal | locInfoLocal | dirLocal | termLocal
translateLocal = attribute translate { "yes" | "no" }?

locInfoLocal =  attribute locInfo { text }?, attribute locInfoRef {
xsd:anyURI }?, attribute locInfoType { "alert" | "description" }

dirLocal = attribute dir { "ltr" | "rtl" | "lro" | "rlo" }?

termLocal =  attribute term { "yes" }?, attribute termRef { xsd:anyURI }?

#On ruby: todo: still need to write the ruby content model, which is
identical to w3c ruby.
rubyLocal = element ruby { text }






<!ENTITY % documentRule "translateRule|locInfoRule|dirRule|termRule
                         |langRule|localeRule|rubyRule|withinTextRule">

<!-- locale usage of ITS are itsLocalAttributes, or ruby -->

<!ENTITY % itsLocal "span|ruby">

<!ELEMENT documentRules (ns*,(%documentRule;)+)>

<!ELEMENT span (#PCDATA)>

<!ELEMENT ns EMPTY>
<!ATTLIST ns
  prefix NMTOKEN #REQUIRED
  uri CDATA #REQUIRED>

<!ENTITY % selector "
  selector CDATA #REQUIRED">

<!ELEMENT translateRule EMPTY>
<!ATTLIST translateRule
  %selector;
  translate (yes|no) #REQUIRED>

<!-- About locInfoRule: At the locInfoRule element, there must be either
an locInfo attribute or an locInfoRef attribute. If none is present,
there must be an locInfoMap attribute. It is an error if there is a
locInfoMap attribute and in addition a locInfo or locInfoRef attribute.
There is an optional locInfoType attribute. -->

<!ELEMENT locInfoRule EMPTY>
<!ATTLIST locInfoRule
  %selector;
  locInfo CDATA #IMPLIED
  locInfoRef CDATA #IMPLIED
  locInfoMap CDATA #IMPLIED
  locInfoType (alert|description) #IMPLIED>

<!ELEMENT dirRule EMPTY>
<!ATTLIST dirRule
  %selector;
  dir (ltr|rtl|lro|rlo) #REQUIRED>

<!-- About termRule: In an instance document, we would need an attribute
term="yes" to indicate a term. In the global rule, "being" a term is
expressed via the name of the element termRule, hence the attribute
term="yes" is not necessary any more. The attributes termRef and
termRefMap are alternatives. It is an error if they occur at the same
termRule element. -->

<!ELEMENT termRule EMPTY>
<!ATTLIST termRule
  %selector;
  termRef CDATA #IMPLIED
  termRefMap CDATA #REQUIRED>

<!-- About langRule: The element langRule is used to express that a
given piece of content (selected by the attribute langMap) is used to
express language information as defined by RFC 3066 or its successor.
Example: <its:langRule its:selector="//p"
its:langMap="@mylangattribute"/> expresses that all p elements have a
language value conformant to RFC 3066 or its successor. The value is
given by the @mylangattribute attached to the p elements. -->

<!ELEMENT langRule EMPTY>
<!ATTLIST langRule
  %selector;
  langMap CDATA #REQUIRED>

<!-- Ablut localeRule: The element localeRule is used to express that a
given piece of content (selected by the attribute localeMap) is used to
express locale information. Example: <its:localeRule its:selector="//p"
its:langMap="@mylocaleattribute"/> expresses that all p elements have a
locale value given by the @mylangattribute, which is attached to the p
elements. The value of @mylocaleattribute might be compliant to RFC 3066
bis, but this is not mandatory. -->

<!ELEMENT localeRule EMPTY>
<!ATTLIST localeRule
  %selector;
  localeMap CDATA #REQUIRED>

<!-- About rubyRule: The element rubyRule is used {1) to map existing
ruby markup to ITS ruby, which itself is defind in terms of the W3C ruby
specification, or (2) to add ruby text to attribute values. Example for
(1): <its:rubyRule its:selector="//span[class='ruby']"
its:rubyBaseMap="span[class='rubyBase']"
its:rubyTextMap="span[class='rubyText']"/> . Example for (2):
<its:rubyRule its:selector="/body/img[1]/@alt" its:rubyBaseMap="."
its:rubyText="World Wide Web Consortium"/> . It is an error if both an
its:rubyText attribute and an its:rubyTextMap attribute occur at the
same <its:rubyRule> element. -->

<!ELEMENT rubyRule EMPTY>
<!ATTLIST rubyRule
  %selector;
  rubyMap CDATA #IMPLIED
  rubyBaseMap CDATA #IMPLIED
  rubyTextMap CDATA #IMPLIED
  rubyText CDATA #IMPLIED>

<!-- withinTextRule is based on Yves / AZ proposal, see
http://www.w3.org/Bugs/Public/show_bug.cgi?id=2878 -->

<!ELEMENT withinTextRule EMPTY>
<!ATTLIST withinTextRule
  %selector;>

<!ATTLIST span
  translate (yes|no) #IMPLIED
  locInfo CDATA #IMPLIED
  locInfoRef CDATA #IMPLIED
  locInfoType (alert|description) #IMPLIED
  dir (ltr|rtl|lro|rlo) #IMPLIED
  term (yes) #IMPLIED
  termRef CDATA #IMPLIED>

<!ENTITY % translateLocal "
  translate (yes|no) #IMPLIED">

<!ENTITY % locInfoLocal "
  locInfo CDATA #IMPLIED
  locInfoRef CDATA #IMPLIED
  locInfoType (alert|description) #REQUIRED">

<!ENTITY % dirLocal "
  dir (ltr|rtl|lro|rlo) #IMPLIED">

<!ENTITY % termLocal "
  term (yes) #IMPLIED
  termRef CDATA #IMPLIED">

<!-- On ruby: todo: still need to write the ruby content model, which is
identical to w3c ruby. -->

<!ELEMENT ruby (#PCDATA)>

Received on Monday, 13 March 2006 17:11:30 UTC