FW: Question about selector scope and rule order

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