Extending com.elovirta.ooxml plugin

Oxygen general issues.
msambasiva
Posts: 87
Joined: Tue Jul 17, 2018 6:57 am

Extending com.elovirta.ooxml plugin

Post 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.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extending com.elovirta.ooxml plugin

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
msambasiva
Posts: 87
Joined: Tue Jul 17, 2018 6:57 am

Re: Extending com.elovirta.ooxml plugin

Post by msambasiva »

Thanks Radu!
msambasiva
Posts: 87
Joined: Tue Jul 17, 2018 6:57 am

Re: Extending com.elovirta.ooxml plugin

Post 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.
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extending com.elovirta.ooxml plugin

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
msambasiva
Posts: 87
Joined: Tue Jul 17, 2018 6:57 am

Re: Extending com.elovirta.ooxml plugin

Post 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.
msambasiva
Posts: 87
Joined: Tue Jul 17, 2018 6:57 am

Re: Extending com.elovirta.ooxml plugin

Post 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
image.png (57.6 KiB) Viewed 3065 times
Attachments
image.png
image.png (49.5 KiB) Viewed 3065 times
Radu
Posts: 9018
Joined: Fri Jul 09, 2004 5:18 pm

Re: Extending com.elovirta.ooxml plugin

Post 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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
msambasiva
Posts: 87
Joined: Tue Jul 17, 2018 6:57 am

Re: Extending com.elovirta.ooxml plugin

Post by msambasiva »

Thanks Radu for looking into the issue!
msambasiva
Posts: 87
Joined: Tue Jul 17, 2018 6:57 am

Re: Extending com.elovirta.ooxml plugin

Post 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.
Post Reply