W3C home > Mailing lists > Public > public-i18n-its@w3.org > January to March 2006

Re: Question about selector scope and rule order

From: Felix Sasaki <fsasaki@w3.org>
Date: Mon, 13 Mar 2006 13:59:09 +0900
Message-ID: <4414FC1D.7060704@w3.org>
To: Yves Savourel <yves@opentag.com>
Cc: public-i18n-its@w3.org

Hi Yves, all,


Yves Savourel wrote:
> Hi all,
>
> I'm running into a question about what exactly the scope of the selector is, and I can't find the answer in the specification. This
> happens when you want to override rules.
>
> <myDoc>
>  <!-- all element not translatable except <text> -->
>  ...
>  <entry id="1">
>   <text>TEXT <code>code</code> TEXT <code>code <sub>TEXT INSIDE CODE</sub> mode code</code> TEXT.</text>
>  </entry>
>  <entry id="2" localize="no">
>   <text>TEXT <code>code</code> TEXT <code>code <sub>TEXT INSIDE CODE</sub> mode code</code> TEXT.</text>
>  </entry>
> </myDoc>
>
> In the document above imagine that none of the elements are translatable except <text>, inside <text> the element <code> is not
> translatable, inside <code> the element <sub> is translatable. This gives us:
>
> <its:translateRule its:selector="//*" its:translate="no"/>
> <its:translateRule its:selector="//text" its:translate="yes"/>
> <its:translateRule its:selector="//code" its:translate="no"/>
> <its:translateRule its:selector="//sub" its:translate="yes"/>
>
> No problem so far.
>
> Then I have to take in account a flag on the <text> element: if the attribute localize='no' then that <text> element is not
> transltable. So can I do simply this:
>
> <its:translateRule its:selector="//text" its:translate="yes"/>
> <its:translateRule its:selector="//code" its:translate="no"/>
> <its:translateRule its:selector="//sub" its:translate="yes"/>
> <its:translateRule its:selector="//text[@localize='no']" its:translate="yes"/>
>
> Or do I need to explicitely re-override all child elements of non-translatable <text> to be sure the <sub> elements do not get
> translated in such <text>?
>
> <its:translateRule its:selector="//text" its:translate="yes"/>
> <its:translateRule its:selector="//code" its:translate="no"/>
> <its:translateRule its:selector="//sub" its:translate="yes"/>
> <its:translateRule its:selector="//text[@localize='no']" its:translate="yes"/>
> <its:translateRule its:selector="//text[@localize='no']/*" its:translate="yes"/>
>
> In other words: the selector points to one or more nodes, we apply the ITS property there. If there are already ITS properties
> applied in some children of these nodes are they overriden or not?
>   

I would say you don't need to do an override: In my XQuery 
implementation, XPath expressions like "//text[@localize='no']" are 
interpreted as "//text[@localize='no']/descendant-or-self::*". How about 
you, Sebastian?

> In some other words: When you do a selection which has its default that include child elements (like translatability) does it
> override any selection done before at the child elements level?
>
> Is this the precedence problem you talked about at Mandelieu and for which there is the Proposal 09?
>   

No, that was only the point of precedence between global and inherited 
local rules.

Cheers,

Felix
Received on Monday, 13 March 2006 04:58:43 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:43:06 UTC