Syntax highlighting for XML language not working

shannonxtreme
Posts: 31
Joined: Fri Aug 24, 2018 4:27 pm

Syntax highlighting for XML language not working

Post by shannonxtreme » Wed May 13, 2020 3:02 pm

I'm using Oxygen 22. I added a codeblock with language-xml as the outputclass, but it isn't doing any highlighting outside of regular monospaced font. Is this intentional or is something wrong?

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

Re: Syntax highlighting for XML language not working

Post by Radu » Thu May 14, 2020 10:17 am

Hi,

This particular @outputclass attribute value is used by default in the PDF and WebHelp outputs obtained from the DITA content using Oxygen's bundled publishing engine to add syntax highlight to the codeblock.
Were you expecting to also see the coloring in the editor area? If so, after you open the topic in the Author visual editing mode there is a "Styles" drop down toolbar button with a CSS layer named "Codeblock syntax highlight", you can click to enable that layer.

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

scherzer
Posts: 3
Joined: Tue Sep 22, 2020 3:15 pm

Re: Syntax highlighting for XML language not working

Post by scherzer » Tue Sep 22, 2020 3:35 pm

I confirm that the language-xml hightlighting does not work - for me since version 3.4.1 and later. To be precise, I'm not after having that highlight in the oxygen-GUI but in the result of the DITA-OT process (PDF).

In ...\Dita-OT3\plugins\com.oxygenxml.highlight\common.xsl

the code

Code: Select all

<xsl:template name="outputStyling" use-when="function-available('version:getProductVersion') or function-available('oxy:highlight')">
in particular the call to

Code: Select all

function-available('oxy:highlight')
returns false (in 3.4.1 but not in 3.3.1)

I would like to analyze further, but all my attempts to dispatch the .jar files and .xsl files do not reveal where I should find the oxy:highlight function. I would appreciate to learn in which module the oxy:highlight function is implemented. That would allow to research why it is not linked in 3.4.1 and higher.

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

Re: Syntax highlighting for XML language not working

Post by Radu » Tue Sep 22, 2020 4:12 pm

Hi,

Are you publishing from the command line using Oxygen's bundled DITA OT installation or a custom DITA OT installation?
If it's a custom DITA OT installation what plugins did you install in it? The license of the "com.oxygenxml.highlight" plugin is a commercial one, it can be used for free when publishing from Oxygen but you need to buy a publishing engine license to use it from the command line.

We also make available a custom DITA OT distribution on our web site along with all our plugins installed in it:
https://www.oxygenxml.com/publishing_engine.html

maybe you can check that out as well, see if it works better from the command line.

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

scherzer
Posts: 3
Joined: Tue Sep 22, 2020 3:15 pm

Re: Syntax highlighting for XML language not working

Post by scherzer » Tue Sep 22, 2020 7:16 pm

As I do have my own (very powerful) additional Xpower-plugin implemented, I am using the command line. You might remember me from a DITA-OT conference in Munich years ago, where I gave a short presentation of the xpower-plugin and I remember your question to look-up my mechanism in order to get highlighting output implemented. So you might have the xpower plugin already (it has more improvements since).

According to your question, the associated oxy:highlight function might perhaps only be available in the oxygen context? Yet, it wasn't until 3.4.1.

I will test your proposal and I don't have objections against buying a commercial product if it is of value for me. I will post my observations.
Thanks for your fast answer ! Helmut

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

Re: Syntax highlighting for XML language not working

Post by Radu » Wed Sep 23, 2020 6:42 am

Hi Helmut,

Nice to hear from you again.
At some point the DITA OT migrated to a new Saxon version which no longer supports directly calling Java methods from XSLT. Java methods can still be called from XSLT using the integrated extension functions mechanism:
https://github.com/dita-ot/dita-ot/pull/2880

So if you look inside the "com.oxygenxml.highlight" bundled with a recent Oxygen version's DITA-OT, in the "lib" folder it has a JAR library xslthl-saxonhe-extension-function.jar which inside has a "META-INF/services" folder which provides the integrated extension function net.sf.xslthl.definition.HighlightFunctionDefinition. As long as this extra JAR library is in the classpath when the DITA OT starts, things should work.
How do you start the DITA-OT? If you start it using the "dita.bat" it should work:

https://www.dita-ot.org/dev/topics/buil ... mmand.html

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

scherzer
Posts: 3
Joined: Tue Sep 22, 2020 3:15 pm

Re: Syntax highlighting for XML language not working

Post by scherzer » Fri Sep 25, 2020 12:55 pm

Dear Radu,

thanks very much for your most helpful explanations. Although I knew about the idea of xslthl-saxonhe-extension-function.jar and I missed to check the CLASSPATH definition which is a beginner's fault (sorry), yet after understanding the background (saxon...) this gives me a better understanding of the process after all. I will improve my build process accordingly.
Result: It is working !!!

BTW: I checked your excellent publication tool which finally doesn't suit my requirements, but is a very good approach - Compliments !

Regards ... Helmut

Post Reply