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

Re: FW: Question about selector scope and rule order

From: Felix Sasaki <fsasaki@w3.org>
Date: Tue, 14 Mar 2006 11:52:38 +0900
Message-ID: <44162FF6.20701@w3.org>
To: Yves Savourel <ysavourel@translate.com>
Cc: public-i18n-its@w3.org
Hi Yves,

According to
http://www.w3.org/TR/2006/WD-its-20060222/#selection-defaults-etc , both
translatability and localization information are handled the same way.

Yves Savourel wrote:
> Hi Felix, Sebastian, and all,
> 
> Mmmm, maybe using "localize='no'" as an example was a bad idea. Let me give you a possibly better example.
> If I have and XHTML file with:
> 
> <p>some text <span class="code">code <span class="text">text in code</span>code</span>.</p>
> <p class="notrans">some text <span class="code">code <span class="text">text in code</span>code</span>.</p>
> 
> Where <span class='code'> is not translatable, <span class='code'> is translatable

I guess this should be <span class='text'> ?
, and <p class='notrans'> paragraphs are not
> translatable.
> 
> I can use the following for dealing with code and text in span:
> 
> <its:translateRule translate="no" its:selector="//span[@class='code']"/>
> <its:translateRule translate="yes" its:selector="//span[@class='text']"/>
> 
> Now, we need to change the rules or add one for handling the <p class='notrans'> element:
> 
> We could do this:
> 
> <its:translateRule translate="no" its:selector="//p[not(@class='notrans')]/span[@class='code']"/>
> <its:translateRule translate="yes" its:selector="//p[not(@class='notrans')]/span[@class='text']"/>
> 
> But it seems much easier to do this:
> 
> <its:translateRule translate="no" its:selector="//span[@class='code']"/>
> <its:translateRule translate="yes" its:selector="//span[@class='text']"/>
> <its:translateRule translate="no" its:selector="//p[@class='notrans']"/>
> 
> My question then is, in this last set of rules, is rule #3 enough to override #2?

As Sebastian pointed out, always the last rule wins. So it is enough, I
think.

> 
> In my implementation it is not enough.
> Felix: your answer, I think, is that it should be enough. I think you're correct, but Sebastian's answer threw me off and I'm not
> sure anymore.

I think it is enough, and it would be in my (and I think in Sebastian's)
implementation.

Cheers,

Felix


Received on Tuesday, 14 March 2006 02:52:50 UTC

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