Page 1 of 1

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

Posted: Fri Apr 15, 2016 12:56 am
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

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

Posted: Fri Apr 15, 2016 9:48 am
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

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

Posted: Sun Apr 17, 2016 5:01 am
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.

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

Posted: Mon Apr 18, 2016 11:45 am
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

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

Posted: Mon Apr 18, 2016 5:23 pm
by hlapin
Hi, and thanks for posting a reply.
I don't know what I was doing wrong, but this now seems to work.