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

FW: Question about selector scope and rule order

From: Yves Savourel <ysavourel@translate.com>
Date: Mon, 13 Mar 2006 15:39:15 -0700
To: <public-i18n-its@w3.org>
Message-ID: <007701c646ee$f54469a0$8f05a8c0@Breizh>

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, 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?

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.

Cheers,
-yves
Received on Monday, 13 March 2006 22:39:57 UTC

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