Editor variables within ${xpath_eval(expression)} in ant parameter [Eclipse plugin]

Having trouble installing Oxygen? Got a bug to report? Post it all here.
hlapin
Posts: 19
Joined: Tue Jul 16, 2013 7:36 pm

Editor variables within ${xpath_eval(expression)} in ant parameter [Eclipse plugin]

Post by hlapin »

Dear all,

Is it possible to use editor variables (e.g., ${cfd}) inside an xpath function as a parameter for an ant transformation?

I want to be able to truncate the current file directory path (or similar path) using the substring-before() function, and append the remainder of the path to a sibling directory. Something like:

Code: Select all

${xpath_eval(substring-before('${cfd}','msword'))}/oxygen/ant/buildFile.xml
If so, I cannot get the syntax right. When I run the transformation the path assigned to the parameter begins with /oxygen.

If someone can point out my error I'd much appreciate it.

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

Re: Editor variables within ${xpath_eval(expression)} in ant parameter [Eclipse plugin]

Post by Radu »

Hi Hayim,

This should work, I tested an example on my side and it worked. The xpath_eval editor variable is expanded after all other editor variables have been expanded precisely to help with use cases like yours.
Maybe you should first try something like:

Code: Select all

${cfd}
just to have a better idea of what the cfd expands to.
Also the "substring-before" is case sensitive when searching for the string.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
hlapin
Posts: 19
Joined: Tue Jul 16, 2013 7:36 pm

Re: Editor variables within ${xpath_eval(expression)} in ant parameter [Eclipse plugin]

Post by hlapin »

Hi. Thanks for you reply.
Here is the path to archive directory (I am transforming a word doc; but I have used ${cfd} with the same effect):

Code: Select all

C:\Users\ ... \mtTranscr-project\mttranscr\msword
The parameter "mtTranscrDir" is set as ${xpath_eval(substring-before('${afd}','msword'))}
and the build file appends this path fragment, "\oxygen\xsl\TEIP5-to-mtTranscr.xsl", to the parameter.

The console reports:

Code: Select all

"-DmtTranscrDir="
...
stylesheet C:\oxygen\xsl\TEIP5-to-mtTranscr.xsl doesn't exist
...
I am hoping that I am missing something simple, but I can't get this to work.
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: Editor variables within ${xpath_eval(expression)} in ant parameter [Eclipse plugin]

Post by Radu »

Hi Hayim,

So you open a DOCX document in the Oxygen Archive browser, open from it the "document.xml" and then apply an ANT transformation to it (probably to convert the Word to TEI).
And in the transformation scenario you set a parameter called mtTranscrDir to:

Code: Select all

${xpath_eval(substring-before('${afd}','msword'))}
but in the ANT console the parameter mtTranscrDir has an empty value, right?
I tested something very similar and it worked for me. What Oxygen version are you using?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
hlapin
Posts: 19
Joined: Tue Jul 16, 2013 7:36 pm

Re: Editor variables within ${xpath_eval(expression)} in ant parameter [Eclipse plugin]

Post by hlapin »

Hi, and thanks for posting a reply.
I don't know what I was doing wrong, but this now seems to work.
Post Reply