Open Office XML for dita topic

Are you missing a feature? Request it's implementation here.
msambasiva
Posts: 48
Joined: Tue Jul 17, 2018 6:57 am

Open Office XML for dita topic

Post by msambasiva » Tue Oct 29, 2019 8:56 am

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.

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

Re: Open Office XML for dita topic

Post by Radu » Tue Oct 29, 2019 10:38 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

msambasiva
Posts: 48
Joined: Tue Jul 17, 2018 6:57 am

Re: Open Office XML for dita topic

Post by msambasiva » Wed Oct 30, 2019 8:16 am

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.

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

Re: Open Office XML for dita topic

Post by Radu » Wed Oct 30, 2019 9:55 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

msambasiva
Posts: 48
Joined: Tue Jul 17, 2018 6:57 am

Re: Open Office XML for dita topic

Post by msambasiva » Mon Dec 02, 2019 9:47 am

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.

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

Re: Open Office XML for dita topic

Post by Radu » Tue Dec 03, 2019 3:46 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

msambasiva
Posts: 48
Joined: Tue Jul 17, 2018 6:57 am

Re: Open Office XML for dita topic

Post by msambasiva » Sun Jul 05, 2020 1:51 pm

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.

msambasiva
Posts: 48
Joined: Tue Jul 17, 2018 6:57 am

Re: Open Office XML for dita topic

Post by msambasiva » Mon Jul 06, 2020 5:01 am

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.

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

Re: Open Office XML for dita topic

Post by Radu » Mon Jul 06, 2020 7:04 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

msambasiva
Posts: 48
Joined: Tue Jul 17, 2018 6:57 am

Re: Open Office XML for dita topic

Post by msambasiva » Mon Jul 06, 2020 11:55 am

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.

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

Re: Open Office XML for dita topic

Post by Radu » Mon Jul 06, 2020 1:49 pm

Hi Samba,

Can you try:

Code: Select all

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

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

msambasiva
Posts: 48
Joined: Tue Jul 17, 2018 6:57 am

Re: Open Office XML for dita topic

Post by msambasiva » Tue Jul 07, 2020 12:08 pm

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.

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

Re: Open Office XML for dita topic

Post by Radu » Tue Jul 07, 2020 12:42 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

msambasiva
Posts: 48
Joined: Tue Jul 17, 2018 6:57 am

Re: Open Office XML for dita topic

Post by msambasiva » Tue Jul 07, 2020 2:41 pm

Thanks Radu!
Its working fine. Able to draft print a topic to word output. It's really great help!!

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

Re: Open Office XML for dita topic

Post by Radu » Tue Jul 07, 2020 3:43 pm

Hi,

Great, I'm glad this works for you.

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

Post Reply