Re: XPath 2.0 in ITS

Hello,
I don't know whether full support for XPath is actually essential, but I 
guess it cannot be implemented just partially. I don't know.

In particular, I miss regex-powered methods like matches(), which afaik 
were introduced in version 2.0.

In XPath 1.0 I can't do:
   <its:translateRule selector="//label/text[matches(text(), 
'[^\s]*\.(svg|jpg|png)')]" translate="no" />

I can only do something like (much more convoluted, as you can see):
   <its:translateRule selector="//label/text['.svg' = substring(., 
string-length(.) - string-length('.svg') +1)][not(contains(text(), ' 
'))]" translate="no" />
   <its:translateRule selector="//label/text['.png' = substring(., 
string-length(.) - string-length('.png') +1)][not(contains(text(), ' 
'))]" translate="no" />
   <its:translateRule selector="//label/text['.jpg' = substring(., 
string-length(.) - string-length('.jpg') +1)][not(contains(text(), ' 
'))]" translate="no" />

What I mean is that implementing specific methods (in Okapi) could 
already be very helpful, even if there's no full support for the whole 
2.0 specification.

My two cents.
Manuel


On 2/2/23 18:55, felix@sasakiatcf.com wrote:
> Hi Yves and all,
>
> there are some incompatibilities between XPath 1.0 and XPath 2.0, see
> https://www.w3.org/TR/2010/REC-xpath20-20101214/#id-backwards-compatibility 
>
> these may be of minor relevance for most use cases.
>
>
>
> Best,
>
> Felix
>
> Am 2023-02-02 14:00, schrieb yves@opentag.com:
>> * I guess that means that if I'm using an Okapi filter in OmegaT, I'm
>> stuck with XPath 1.0 until version 2.0 gets implemented in Okapi.
>>     * Is that correct?
>>
>> Yes
>>
>>     * Would implementing support for XPath 2.0 in Okapi be a lot of 
>> work?
>> (hours, days, weeks)
>>
>> I have not looked at that code in years, but likely several days,
>> maybe a week. We would have to find a XPath 2.0 library first, then
>> have the code able to switch between both 1.0 and 2.0 (or maybe 2.0
>> can handle 1.0 too). Anyway. It really depends on various factors.
>>
>> -ys
>>
>> From: Manuel Souto Pico [cApStAn] <manuel.souto@capstan.be>
>> Sent: Thursday, February 2, 2023 11:13 AM
>> To: yves@opentag.com; public-i18n-its-ig@w3.org
>> Subject: Re: XPath 2.0 in ITS
>>
>> Thank you, Yves.
>>
>> So the lack of support for XPath 2.0 is not in ITS but on Okapi's side
>>
>> I guess that means that if I'm using an Okapi filter in OmegaT, I'm
>> stuck with XPath 1.0 until version 2.0 gets implemented in Okapi.
>>
>> Is that correct?
>>
>> Would implementing support for XPath 2.0 in Okapi be a lot of work?
>> (hours, days, weeks)
>>
>> Thanks a lot.
>> Cheers, Manuel
>>
>> On 2/2/23 5:00, yves@opentag.com wrote:
>>
>>> Hi Manuel,
>>>
>>> Technically, ITS 2.0 could use other versions than XPath 1.0. You
>>> would have to specify it in an queryLanguage attribute in <rules>.
>>>
>>> But it means that the ITS processor would have to support it as
>>> well. Currently the ITS processor implemented in Okapi does not.
>>>
>>> Cheers,
>>>
>>> -yves
>>>
>>> From: Manuel Souto Pico [cApStAn] <manuel.souto@capstan.be>
>>> Sent: Wednesday, February 1, 2023 11:12 PM
>>> To: public-i18n-its-ig@w3.org
>>> Subject: XPath 2.0 in ITS
>>>
>>> You don't often get email from manuel.souto@capstan.be. Learn why
>>> this is important [1]
>>>
>>> Dear all,
>>>
>>> I understand ITS 2.0 currently only supports XPath 1.0. Could you
>>> please confirm whether that's correct?
>>>
>>> If that's the case, is there any workaround to use XPath 2.0 methods
>>> with ITS Version 2.0?
>>>
>>> Thanks a lot.
>>> Cheers, Manuel
>>>
>>> Manuel Souto Pico
>>> Lead translation technologist
>>> ____________________________
>>>
>>> cApStAn SA, Brussels
>>> http://www.capstan.be
>>> ____________________________
>>
>> -- 
>>
>> Manuel Souto Pico
>> Lead translation technologist
>> ____________________________
>>
>> cApStAn SA, Brussels
>> http://www.capstan.be
>> ____________________________
>>
>>
>>
>> Links:
>> ------
>> [1] https://aka.ms/LearnAboutSenderIdentification

-- 

*Manuel Souto Pico*
Lead translation technologist
____________________________

cApStAn SA, Brussels
http://www.capstan.be
____________________________

Received on Thursday, 2 February 2023 18:19:47 UTC