Re: separating precedence of 2 types of inheritance

Thanks. Is there a page on the Wiki for suggested edits to the spec? I
don't see anything on the list of
pages<http://www.w3.org/International/its/wiki/Special:AllPages>
.
Nathan

On Fri, Aug 9, 2013 at 7:55 AM, Felix Sasaki <fsasaki@w3.org> wrote:

>  Hi Nathan,
>
> Am 08.08.13 01:47, schrieb Nathan Glenn:
>
> Thanks for clearing this up for me, Felix and Fredrick. I think section
> 5.5 could use the beefed-up explanation that Fredrik provided for number
> three: inherit from closest parent, local beats global. (Like CSS)
>
>
> Good idea - do you want to add that to the wiki as well?
>
>
>  One more question on this. Section 5.5 says inheritance only applies to
> elements, but section 8.1 lists inheritance rules for child elements and
> attributes related to their "child notes". It sounds like they are saying
> different things, but I may be misunderstanding the text. Also, is that
> supposed to be "child nodes"?
>
>
> The inheritance rules have the perspective (in 5.5. and 8.1 and in
> general) from the node that potentially inherits to its child notes. So the
> column in 8.1. "Inheritance for elements nodes" is about the question: if
> an element is selected via local markup or a global rule - does the
> attached ITS information apply to the nested elements or attributes?
>
> Hope that this helps. Of course explanation by example is not sufficient,
> but the test suite might help here as well. You see a lot of examples of
> inheritance by just browsing the output (and comparing it to the input)
> https://github.com/finnle/ITS-2.0-Testsuite/tree/master/its2.0/expected/
> https://github.com/finnle/ITS-2.0-Testsuite/tree/master/its2.0/inputdata/
>
> Felix
>
>
>
>  Nathan
>
> On Wed, Aug 7, 2013 at 12:12 PM, Fredrik Liden <fliden@enlaso.com> wrote:
>
>>  Hi Nathen and Felix,
>>
>>
>>
>> *, and ITS could get pretty clumsy. For example, there would be no way
>> to set an entire Arabic document as right-to-left (**<its:dirRule
>> selector="/*" dir="rtl">** or **selector="//*"**) and then mark the
>> parent of several English elements with **its:dir="ltr"**.*
>>
>>
>>
>> Any rule with selector “/*” in effect disables the inheritance mechanism
>> so it’s useful when that is what you really want to do and also in cases
>> where perhaps you’re dealing with a category that doesn’t have any
>> Inheritance (http://www.w3.org/TR/its20/#datacategories-defaults-etc).
>>  The default Directionality is “ltr” so in your case, similar to a
>> Translate category use case, you could specify < its:dirRule
>> selector="/somerootelement" dir=”rtl”>. Now all the child elements of
>> <somerootelement> inherits “rtl” then you can mark your specific “parents”
>> with its:dir=”ltr”. Now the marked parents and their children (through
>> inheritance) have “ltr”.
>>
>>
>>
>> Looking at the processing steps Felix describes for Okapi, once the
>>  global and local rules have been applied in order of priority, for any
>> given element/attribute you really only have:
>>
>> 1.       Explicit rule value
>>
>> 2.       Inherited rule value
>>
>> 3.       Default rule value
>>
>>
>>
>> But for an implementer there order is:
>>
>>
>>
>> 1. Local markup
>>
>> 2. Global selectors
>>
>> 3. Inherited values (Inherited from nearest parent with either relevant
>> local markup or global selectors. In cases where the parent has both local
>> markup and global rules, inheritance from local markup has precedence
>> (consistent with 1 and 2). But again, implementation-wise, once the rules
>> have been applied there’s really no distinction. A little bit of the
>> chicken and the egg perhaps. )
>>
>> 4. Default values
>>
>>
>>
>> Fredrik
>>
>>
>>
>>
>>
>> *From:* Felix Sasaki [mailto:fsasaki@w3.org]
>> *Sent:* Wednesday, August 07, 2013 12:53 AM
>> *To:* Nathan Glenn
>> *Cc:* public-i18n-its-ig@w3.org
>> *Subject:* Re: separating precedence of 2 types of inheritance
>>
>>
>>
>> Hi Nathan again,
>>
>> Am 07.08.13 05:42, schrieb Nathan Glenn:
>>
>> Hello again,
>>
>> I was wondering if I could ask a question about inheritance and
>> precedence. Section 5.5 of the spec gives information on this, but leaves
>> the proper implementation unclear in my mind.
>>
>> Implementing global selection makes a lot of sense to me because once
>> rules are properly ordered, they can all be applied and later ones will
>> overwrite older ones. However, it is less clear for inheritance. What I
>> would like to think is that one could do the following in order to decide
>> the ITS metadata for an entire document:
>>
>>    1. Apply default values.
>>    2. Apply global selection via rules, one at a time, also applying
>>    inheritance for each one. Each rule application writes over any previous
>>    ones.
>>    3. Apply selection via explicit local markup, and then the
>>    inheritance of this markup, overwriting any previously applied selections.
>>    Application would be a pre-order operation in a depth-first search (or
>>    something else that would cause selections for children to overwrite
>>    selections/inheritance via ancestors).
>>
>>   However, the specification for precedence of selection from section
>> 5.5 is:
>>
>>    1. local markup
>>    2. global selectors
>>    3. inherited values
>>    4. default values
>>
>>
>> Correct.
>>
>>
>>   The problem with this is that there are 2 types of inheritance:
>> inheritance from global selections (example 13) and inheritance from local
>> selections (example 11), and the given precedence order implies that they
>> are both at the same level.
>>
>>
>> They actually are at the same level.
>>
>>
>>   If they were, then implementation would be much less simple than the 3
>> step process outlined above
>>
>>
>>
>> There is a mismatch between your steps and the four types of inheritance.
>> Your steps describe an algorithm how to process (your type of) inheritance.
>> The four types of inheritance are "declarative": they don't presprice how
>> to process ITS information, but only how the relation between the four
>> types of information is.
>> A simple algorithm to process the four types of inheritance could have
>> two steps:
>>
>> 1) For the input document apply global rules taking their order into
>> account ("the last rule wins"). Output: an XML / HTML DOM decorated with
>> ITS information
>> 2) Traverse the decorated DOM. For each node check if there is local
>> markup and if yes apply that. If there is no local markup check if there is
>> a decoration from step 1). If there is no decoration check for inherited
>> values, then default values.
>>
>> Although 2) has several sub parts, I am saying "two steps" since you only
>> need to process the document twice: decoration for global rules and
>> traversing for the rest. If I recall correctly, the okapi ITS
>> implementation uses that kind of approach. The second step then can be
>> implemented in streaming mode and hence is relatively efficient.
>>
>>
>>   , and ITS could get pretty clumsy. For example, there would be no way
>> to set an entire Arabic document as right-to-left (<its:dirRule
>> selector="/*" dir="rtl"> or selector="//*") and then mark the parent of
>> several English elements with its:dir="ltr".
>>
>>
>> I see this rather as an issue that you can resolve by educating authors.
>> Take CSS as an example: if authors have markup like this
>> <!DOCTYPE html>
>> <html>
>>   <head>
>>     <meta content="text/html; charset=UTF-8" http-equiv="content-type">
>>     <title>Example of CSS inheritance</title>
>>     <style type="text/css">
>>       span {color: red;}  </style>
>>   </head>
>>   <body>
>>     <p><span style="color:blue;">blue, via local style attribute
>> <span>red via
>>           global style element</span> </span></p>
>>   </body>
>> </html>
>>
>> They know that the local style attribute does not inherit to the nested
>> span, since the nested span is selected directly via a global CSS element.
>>
>> So rather than complicating the implementations and eventually how ITS
>> markup authors have to understand inheritance, I would keep things as they
>> are - relatively simple and aligned with well known CSS.
>>
>>
>>   You would have to set the direction on each individual element, or
>> create another global selector and place it after the first.
>>
>>
>>
>> I think that the precedence order should probably be:
>>
>>    1. local markup
>>    2. inherited local markup
>>    3. global selectors
>>    4. inheritance from global selectors
>>    5. default values
>>
>> Provided it is correct, it makes it easier to see that a proper
>> implementation of ITS is simply the reverse application of this list. One
>> could even combine 1-2 and 3-4.
>>
>>
>>
>> I'm sorry if I'm way off on this. Could someone tell me if my
>> understanding of precedence and inheritance is correct?
>>
>>
>> I hope that above CSS example made this clear.
>>
>> Best,
>>
>> Felix
>>
>>
>>
>> Nathan
>>
>>
>>
>
>
>

Received on Friday, 9 August 2013 19:35:11 UTC