Page 1 of 1

xpath_eval variable in code templates

Posted: Fri Jun 26, 2015 11:37 pm
by ttasovac
what's wrong with the following code template?

Code: Select all

<cit type="translation"> <quote xml:lang="de">${xpath_eval(${selection},1,string-length(${selection})-1)}</quote></cit>
the xpath_eval returns nothing.

all best,
toma

Re: xpath_eval variable in code templates

Posted: Mon Jun 29, 2015 11:42 am
by Radu
Hi Toma,

Your use case is quite interesting, I must admit we have not thought about it.
It all depends on the order in which the editor variables are expanded, in this case we expand first the xpath editor variable and then the selection editor variable. But we could try to reverse that, I will add an issue for it and update the forum thread when we manage to solve it.

Regards,
Radu

Re: xpath_eval variable in code templates

Posted: Mon Jun 29, 2015 11:56 am
by ttasovac
Thanks Radu, I have a whole range of use cases where this type of manipulation would make a lot of sense. Looking forward to seeing a solution for this.
All best,
Toma

Re: xpath_eval variable in code templates

Posted: Mon Jul 13, 2015 12:03 pm
by Radu
Hi Toma,

We'll work to fix this in Oxygen 17.1. By the way, when it will work, the expression that you will need to write will be something like:

Code: Select all

 <cit type="translation"> <quote xml:lang="de">${xpath_eval(substring('${selection}',1,string-length('${selection}')-1))}</quote></cit> 
Your original example did not contain the substring function + extra quotes need to be added around the selection expanded content in order to treat it as a literal.

Regards,
Radu

Re: xpath_eval variable in code templates

Posted: Mon Jul 13, 2015 9:45 pm
by ttasovac
excellent! looking forward to it...

Re: xpath_eval variable in code templates

Posted: Fri Dec 18, 2015 1:32 pm
by Radu
Hi,

Just to update this thread, Oxygen 17.1 should contain a fix for this.

Regards,
Radu