xpath_eval variable in code templates

Oxygen general issues.
ttasovac
Posts: 82
Joined: Fri Dec 19, 2003 6:02 pm

xpath_eval variable in code templates

Post 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
Radu
Posts: 9046
Joined: Fri Jul 09, 2004 5:18 pm

Re: xpath_eval variable in code templates

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
ttasovac
Posts: 82
Joined: Fri Dec 19, 2003 6:02 pm

Re: xpath_eval variable in code templates

Post 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
Radu
Posts: 9046
Joined: Fri Jul 09, 2004 5:18 pm

Re: xpath_eval variable in code templates

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
ttasovac
Posts: 82
Joined: Fri Dec 19, 2003 6:02 pm

Re: xpath_eval variable in code templates

Post by ttasovac »

excellent! looking forward to it...
Radu
Posts: 9046
Joined: Fri Jul 09, 2004 5:18 pm

Re: xpath_eval variable in code templates

Post by Radu »

Hi,

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

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply