xpath_eval variable in code templates

<oXygen/> general issues.
ttasovac
Posts: 51
Joined: Fri Dec 19, 2003 6:02 pm

xpath_eval variable in code templates

Post by ttasovac » Fri Jun 26, 2015 11:37 pm

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: 7019
Joined: Fri Jul 09, 2004 5:18 pm

Re: xpath_eval variable in code templates

Post by Radu » Mon Jun 29, 2015 11:42 am

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: 51
Joined: Fri Dec 19, 2003 6:02 pm

Re: xpath_eval variable in code templates

Post by ttasovac » Mon Jun 29, 2015 11:56 am

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: 7019
Joined: Fri Jul 09, 2004 5:18 pm

Re: xpath_eval variable in code templates

Post by Radu » Mon Jul 13, 2015 12:03 pm

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: 51
Joined: Fri Dec 19, 2003 6:02 pm

Re: xpath_eval variable in code templates

Post by ttasovac » Mon Jul 13, 2015 9:45 pm

excellent! looking forward to it...

Radu
Posts: 7019
Joined: Fri Jul 09, 2004 5:18 pm

Re: xpath_eval variable in code templates

Post by Radu » Fri Dec 18, 2015 1:32 pm

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