Page 1 of 1

Open Office XML for dita topic

Posted: Tue Oct 29, 2019 8:56 am
by msambasiva
Hi,

We are using XML Editor 21.0, build 2019022207. We have a requirement to have a plugin to support draft print of dita topic to dox. As of now, we found plugin 'com.elovirta.ooxml' to draft print a map to Open Office XML docx. Please suggest if there is any workaround to draft print a topic to docx. Also please suggest if there is any plugin which I can extend to generate docx output.

Thanks,
Samba.

Re: Open Office XML for dita topic

Posted: Tue Oct 29, 2019 10:38 am
by Radu
Dear Samba,

Right now the DITA to Word publishing does not work for topics, I added an issue based on your request on the project's Github issues list:

https://github.com/jelovirt/com.elovirt ... /issues/66

The particular DITA OT plugin which does the DITA to Word publishing is located in OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT3.x\plugins\com.elovirta.ooxml.
And it has a small tutorial about extending it:

https://github.com/jelovirt/com.elovirt ... /Extending

Regards,
Radu

Re: Open Office XML for dita topic

Posted: Wed Oct 30, 2019 8:16 am
by msambasiva
Hi Radu,

Thank you so much for raising an issue for me. Extending an existing plugin com.elovirta.ooxml might not help in converting DITA topic to docx. May I expect ETA on this issue?

Thanks,
Samba.

Re: Open Office XML for dita topic

Posted: Wed Oct 30, 2019 9:55 am
by Radu
Hi Samba,

Sorry but I cannot give you a time estimate on this. It's a third party library integrated in Oxygen. Also the use case that you have, of producing a Word document for each topic seems to be quite rare.

Regards,
Radu

Re: Open Office XML for dita topic

Posted: Mon Dec 02, 2019 9:47 am
by msambasiva
Hi,

When I open a dita topic from OXygen Editor 21 and try to configure a transformation, found below three scenarios, DITA PDF, DITA XHTML, DITA HTML5. Could you suggest the plugin name used for DITA PDF option?

I want to check if I can extend the plugin used for DITA PDF in my custom plugin and write OpenOffice XML code to generate docx output for a topic.

Thanks,
Samba.

Re: Open Office XML for dita topic

Posted: Tue Dec 03, 2019 3:46 pm
by Radu
Hi Samba,

The build.xml for the DITA to PDF plugin is this one:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT3.x\plugins\org.dita.pdf2\build.xml

You can look inside it, it has a target named "topic2pdf2" which gets executed only if the "noMap" parameter has been set in the base build files.
Another option for you would be to have a custom script or build file which automatically creates a DITA Map, refers in it the current topic and then continues the publishing on this temporary DITA Map.

Regards,
Radu

Re: Open Office XML for dita topic

Posted: Sun Jul 05, 2020 1:51 pm
by msambasiva
Hi Radu,

It's been long time once again got a chance to revisit this topic.
Iam trying with second option i.e custom script or build file which automatically creates a DITA Map, refers in it the current topic and then continues the publishing on this temporary DITA Map.

I can able to create a dita map programaticaly some thing as below using <xslt> task,
<project name="uae.dita.topicdocx">
<target name="dita2topicdocxOHC"
depends="dita2topicdocxOHC.init,
dita2docx"/>
<target name="dita2topicdocxOHC.init">
<xslt in="temp.xml" out="${args.input.dir}${file.separator}custom_map.ditamap" style="${dita.plugin.uae.dita.topicdocx.dir}${file.separator}docx${file.separator}word${file.separator}build_ditamap.xsl">
</xslt>
<property name="args.input" location="${args.input.dir}${file.separator}custom_map.ditamap"/>
But when I try to echo the args.input, it's still pointing to dita topic but not map. Please suggest the best way to set the args.input value to custom dynamic map.

Thanks,
Samba.

Re: Open Office XML for dita topic

Posted: Mon Jul 06, 2020 5:01 am
by msambasiva
Hi,

Able to print the value of
args.input
but not
args.input.dir
. . Below is console message,

[echo] ** args.input= D:\PROJECTS\Oxygen_draft_printing\topic2docx\testing\preface.ditamap
[echo] ** args.input.dir= ${args.input.dir}

Please suggest any clue on this.

Thanks,
Samba.

Re: Open Office XML for dita topic

Posted: Mon Jul 06, 2020 7:04 am
by Radu
Hi Samba,

Usually with ANT property values are immutable, once a property has a value, you will not be able to change it.
One hack to change the value of a property would be to use some Javascript code in the ANT build file:

https://stackoverflow.com/questions/186 ... rty-in-ant

like this example you will find there:

Code: Select all

<scriptdef name="propertyreset" language="javascript"
    description="Allows to assign @{property} new value">
    <attribute name="name"/>
    <attribute name="value"/>
        project.setProperty(attributes.get("name"), attributes.get("value"));
</scriptdef>
Another solution might be to create a custom ANT build file separate from the DITA OT build files, in that custom ANT build file create the DITA Map, then from it use the <exec> task to start the DITA OT giving it various parameters. So you would be no longer work from inside a DITA OT plugin.

Regards,
Radu

Re: Open Office XML for dita topic

Posted: Mon Jul 06, 2020 11:55 am
by msambasiva
Thanks Radu.

I can't able to reset the args.input parameter value. Below is the corresponding code & console log,
<target name="dita2topicdocxOHC.init">
<propertyreset name="args.input" location="${input.dir}\custom_map.ditamap"/>
<propertyreset name="temp" location="${input.dir}\custom_map.ditamap"/>
<echo level="info">** temp = ${arg.temp}</echo>
<echo level="info">** args.input = ${args.input}</echo>
</target>
<scriptdef name="propertyreset" language="javascript"
description="Allows to assign @{property} new value">
<attribute name="name"/>
<attribute name="location"/>
project.setProperty(attributes.get("name"), attributes.get("location"));
<![CDATA[
self.log("From propertyreset");
self.log("name = " + attributes.get("name"));
self.log("location = " + attributes.get("location"));
]]>
</scriptdef>
dita2topicdocxOHC.init:
[propertyreset] From propertyreset
[propertyreset] name = args.input
[propertyreset] location = D:\PROJECTS\Oxygen_draft_printing\topic2docx\testing\custom_map.ditamap
[propertyreset] From propertyreset
[propertyreset] name = temp
[propertyreset] location = D:\PROJECTS\Oxygen_draft_printing\topic2docx\testing\custom_map.ditamap
[echo] ** temp = D:\PROJECTS\Oxygen_draft_printing\topic2docx\testing\custom_map.ditamap
[echo] ** args.input = D:\PROJECTS\Oxygen_draft_printing\topic2docx\testing\preface.ditamap
Please suggest any clue.

Thanks,
Samba.

Re: Open Office XML for dita topic

Posted: Mon Jul 06, 2020 1:49 pm
by Radu
Hi Samba,

Can you try:

Code: Select all

project.setUserProperty('args.input', ....);
instead of "setProperty"?

Regards,
Radu

Re: Open Office XML for dita topic

Posted: Tue Jul 07, 2020 12:08 pm
by msambasiva
Thanks Radu. Its working with project.setUserProperty('args.input', ....);

Some how I cant able to create temp folder under DITA OT of Oxygen. Is it ok if we create temp folder some thing below using ENV variable. Pls suggest if there is a best option to create temp directory on Windows using build script.
<temppropertyset name="temp.dir"/>
<property name="dita.temp.dir" location="${temp.dir}${file.separator}temp${file.separator}temp${current.date}"/>
<mkdir dir="${dita.temp.dir}"/>

<scriptdef name="temppropertyset" language="javascript"
description="Allows to assign @{property} new value">
<attribute name="name"/>
var temp = java.lang.System.getenv('temp');
project.setUserProperty(attributes.get("name"), temp);
<![CDATA[
self.log("From temppropertyset");
self.log("name = " + attributes.get("name"));
self.log("temp = " + temp);
]]>
</scriptdef>
Thanks,
Samba.

Re: Open Office XML for dita topic

Posted: Tue Jul 07, 2020 12:42 pm
by Radu
Hi Samba,

Oxygen's bundled DITA OT is usually in the program files folder and an external process cannot make changes inside the program files folder unless it is run with admin privileges.
So you took the right approach to create a temp files folder in a place where you have full read-write access. You could have created one even in the folder where the original published DITA topic was located.

Regards,
Radu

Re: Open Office XML for dita topic

Posted: Tue Jul 07, 2020 2:41 pm
by msambasiva
Thanks Radu!
Its working fine. Able to draft print a topic to word output. It's really great help!!

Re: Open Office XML for dita topic

Posted: Tue Jul 07, 2020 3:43 pm
by Radu
Hi,

Great, I'm glad this works for you.

Regards,
Radu