Re: ITS rules for OpenDocument

Felix Sasaki wrote:
>
> Hi Yves,
>
> Yves Savourel さんは書きました:
>> Looking at the rules you are using Felix, I saw:
>>
>> <its:translateRule selector="//*" translate="no"/>
>> <its:translateRule selector="//w:p | //*[ancestor::w:p]" 
>> translate="yes"/>
>>
>> I guess we could get the same results with (I think):
>>
>> <its:translateRule selector="/w:document" translate="no"/>
>> <its:translateRule selector="//w:p" translate="yes"/>
>>
>> But I wonder what would be the most efficient way? Use the 
>> inheritence of translate (solution b) or label the nodes (solution 
>> a)? Or
>> both are equivalent in term of processing. I would tend to guess that 
>> b would be a bit better because some processors may do the
>> inheritence as they go rather than as a separate pass. But maybe I'm 
>> missing something.
>>   
>
> You are right, both solutions are equivalent. I'm not sure if the 2nd 
> solution is better since in both cases you need two global rules, and 
> I'm not sure about the effect of XPath rewriting Jirka mentioned a 
> while ago. But you could have just one global rule like this:
>
> <its:translateRule selector="//*[not(w:p or ancestor::w:p)]" 
> translate="no"/>
>
> which takes advantage of the default that elements are translatable. 
> It will be in effect for w:p and it's descendants.
I think you mean <its:translateRule 
selector="//*[not(ancestor-or-self::w:p)]" translate="no"/> :-}

Personally, I would always favour

<its:translateRule selector="w:document" translate="no"/>
<its:translateRule selector="w:p" translate="yes"/>

because it is more human-readable. Efficiency should be left to 
implementations, not
second-guessed by rule authors, surely?

-- 
Sebastian Rahtz      
Information Manager, Oxford University Computing Services
13 Banbury Road, Oxford OX2 6NN. Phone +44 1865 283431

Received on Wednesday, 30 July 2008 08:22:24 UTC