Page 1 of 1

Extending com.elovirta.ooxml plugin

Posted: Tue Oct 29, 2019 9:24 am
by msambasiva
Hi,

We are using XML Editor 21.0, build 2019022207. We have a requirement to enhance the draft print of a map to docx. Created a new plugin which extends 'com.elovirta.ooxml'. So far we are able to generate a docx file with default look and feel of guide. Now we need to provide a red font color to hyper links.

There is already template in com.elovirta.ooxml plugin which is handling xrefs.
<xsl:template match="*[contains(@class, ' topic/xref ')]" name="topic.xref">

Do I need to override the template in my custom plugin? Please suggest if there is any better option to enhance inbuilt feature of href content.

Thanks,
Samba.

Re: Extending com.elovirta.ooxml plugin

Posted: Tue Oct 29, 2019 10:39 am
by Radu
Hi Samba,

There is a section about extending the DITA to Word XSLT here:

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

Regards,
Radu

Re: Extending com.elovirta.ooxml plugin

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

Re: Extending com.elovirta.ooxml plugin

Posted: Wed Nov 06, 2019 7:41 pm
by msambasiva
Hi Radu,

integrator.xml:
--------------------
<target name="dita2docxOHC"
depends="dita2docxOHC.init,
dita2docx"/>
<target name="dita2docxOHC.init">
<property name="document.xsl" location="${dita.plugin.uae.dita.docx.dir}/cfg/custom.xsl"/>
</target>

custom.xsl:
--------------
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:rx="http://www.renderx.com/XSL/Extensions"
version="2.0">
<xsl:import href="document.topic.xsl"/>
<xsl:output method="xml" encoding="utf-8" indent="yes"/>
</xsl:stylesheet>

Taken document.topic.xsl from default plugin with single template having <xsl:message> as below

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:rx="http://www.renderx.com/XSL/Extensions"
version="2.0">

<xsl:import href="../../com.elovirta.ooxml/docx/word/document.topic.xsl"/>

<xsl:template match="*[contains(@class, ' topic/section ')]" name="section">
<xsl:message>topic/section from custom plugin</xsl:message>
<xsl:apply-templates select="*"/>
</xsl:template>
</xsl:stylesheet>


Throwing below stylesheet compilation error message while applying transformation scenario on ditamp,
System ID: C:\dita-ot-2.4.6\out\FBDI\maprefs\Asset_Tracking.ditamap
Scenario: Asset_Tracking (UAE OOX)
Input file: C:\dita-ot-2.4.6\out\FBDI\maprefs\Asset_Tracking.ditamap
Engine name: DITA-OT
Severity: fatal
Description: Transformation failed. C:\Program Files (x86)\Oxygen XML Editor 21\frameworks\dita\DITA-OT3.x\plugins\com.elovirta.ooxml\build.xml:104: javax.xml.transform.TransformerConfigurationException: net.sf.saxon.s9api.SaxonApiException: Errors were reported during stylesheet compilation

System ID: C:\Program Files (x86)\Oxygen XML Editor 21\frameworks\dita\DITA-OT3.x\plugins\com.elovirta.ooxml\docx\word\document.topic.xsl
Scenario: Asset_Tracking (UAE OOX)
Input file: C:\dita-ot-2.4.6\out\FBDI\maprefs\Asset_Tracking.ditamap
Engine name: XSLT
Severity: fatal
Description: Cannot find a 1-argument function named {com.elovirta.ooxml}get-style-indent()
Start location: 26:8

System ID: C:\Program Files (x86)\Oxygen XML Editor 21\frameworks\dita\DITA-OT3.x\plugins\com.elovirta.ooxml\docx\word\document.topic.xsl
Scenario: Asset_Tracking (UAE OOX)
Input file: C:\dita-ot-2.4.6\out\FBDI\maprefs\Asset_Tracking.ditamap
Engine name: XSLT
Severity: fatal
Description: Variable sectPr has not been declared (or its declaration is not in scope)
Start location: 76:7
It would be great help, if you can provide any clue on the issue.
Thanks,
Samba.

Re: Extending com.elovirta.ooxml plugin

Posted: Thu Nov 07, 2019 11:01 pm
by Radu
Hi Samba,

I do not know much about the plugin but I think your custom.xsl needs to be the equivalent of this file "DITA-OT3.x/plugins/com.elovirta.ooxml/docx/word/document.xsl".

So the custom.xsl should probably contain something like:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:rx="http://www.renderx.com/XSL/Extensions"
version="2.0">
<xsl:import href="../../com.elovirta.ooxml/docx/word/document.xsl"/>
<xsl:template match="*[contains(@class, ' topic/section ')]" name="section">
<xsl:message>topic/section from custom plugin</xsl:message>
<xsl:apply-templates select="*"/>
</xsl:template>
</xsl:stylesheet>
Regards,
Radu

Re: Extending com.elovirta.ooxml plugin

Posted: Mon Nov 11, 2019 7:00 am
by msambasiva
Thanks Radu!. It's working. Able to invoke my custom plugin custom.xsl which is equivalent to com.elovirta.ooxml/docx/word/document.xsl.

If you don't mind, could you suggest a solution for another issue described below.

Copied Normal.docx file from default plugin com.elovirta.ooxml\resources to custom plugin uae.dita.docx\resources by changing the font Calibri Light (Headings) to Oracle Sans Extra Bold for Heading 1. But when I generate the output docx file, it's having Heading 1 font as Calibri Light (Headings). I've edited 'dotx.file' parameter to point to my custom plugin as C:\Program Files (x86)\Oxygen XML Editor 21\frameworks\dita\DITA-OT3.x\plugins\uae.dita.docx\resources\Normal.docx . Please suggest if I am missing some thing to change the font of my output docx file.

Re: Extending com.elovirta.ooxml plugin

Posted: Mon Nov 11, 2019 10:52 am
by msambasiva
Please find the attached screenshot of the Normal.txt with font style & size. Also please find the attached screenshot of output docx with default font style & size.
Please suggest if I want to generate output having custom font.

Image
image.png

Re: Extending com.elovirta.ooxml plugin

Posted: Thu Nov 14, 2019 12:39 pm
by Radu
Hi,
I see you added another post for this:
viewtopic.php?f=8&t=20894

I will try maybe sometime next week to look into this then respond on the other forum thread, I'm not very familiar with what the plugin does.

Regards,
Radu

Re: Extending com.elovirta.ooxml plugin

Posted: Fri Nov 15, 2019 8:16 am
by msambasiva
Thanks Radu for looking into the issue!

Re: Extending com.elovirta.ooxml plugin

Posted: Fri Nov 15, 2019 1:01 pm
by msambasiva
The issue got fixed. The changes for Template file needs to be updated in 'Modify Style' window when we right click on font. Otherwise the changes were not picking into the output.
Thanks,
Samba.