Page 1 of 1

Transformation Scenario ${xpath_eval} and regex

Posted: Thu Nov 07, 2019 11:18 am
by whyme
I am using editor variable ${xpath_eval} within a transformation output scenario Save As box, because I want to tweak the base uri of the input before sending it to output. But when I do something like this...

Code: Select all

${pd}/${xpath_eval(replace(base-uri(),'.+/(\w+).+','$1'))}.html
...I get an error. The line has been interpreted as asking for the file to be saved at `${pd}/${base-uri()}` (if such an editor variable existed). When I open up the transformation scenario I see that the formula has been changed to this...

Code: Select all

${pd}/${xpath_eval(replace(base-uri(),'.+/(/w+).+','$1'))}.html
It works fine if I change \w to something like [a-zA-Z0-9].

I assume that oXygen is normalizing path separators. Is there any way to exempt backslashes that are in an {$xpath_eval}?

Re: Transformation Scenario ${xpath_eval} and regex

Posted: Thu Nov 07, 2019 3:59 pm
by alex_jitianu
Hello,

Thank you for reporting this issue. We will send you a notification as soon as it gets fixed and a new build containing the fix is released. Until then, perhaps you can tweak the regular expression a bit, replacing that backslash with a different construction. If I understand it correctly, you want to keep just the first word from the file name. An [^abc] construction could work, if there are certain patterns that your files usually have:

Code: Select all

replace(base-uri(),'.+/([^/. -_]+).+','$1')
Best regards,
Alex

Re: Transformation Scenario ${xpath_eval} and regex

Posted: Wed Feb 19, 2020 8:17 am
by Radu
Hi,

Just to update this thread, the problem was fixed in Oxygen version 22.

Regards,
Radu