Page 1 of 1

xslthl not working

Posted: Fri Apr 03, 2009 5:24 pm
by haad
Hi,


I tried to get syntax highlighting for code in programlistings working today. I downloaded xslthl.zip an put it to disk. I put xslthl.jar to lib directory in oxygen dir. I use saxon6.5.5 and custom fop with my native language fonts.

Code: Select all


[haad@ ~]$ ls /Users/haad/Opt/xslthl/                                      
LICENSE.txt highlighters xslthl-2.0.1.jar
My transformation scenario has these highlight values set properly I think, but I still have no success with generation nice code :).

Code: Select all


highlight.default.language	"c"
highlight.source 1
highlight.xslthl.config file:///Users/haad/Opt/xslthl/highlighters/xslthl-config.xml
xslthl-config is contains this.

Code: Select all


<xslthl-config>
<highlighter id="java" file="/Users/haad/Opt/xslthl/highlighters/java-hl.xml" />
<highlighter id="delphi" file="/Users/haad/Opt/xslthl/highlighters/delphi-hl.xml" />
<highlighter id="pascal" file="/Users/haad/Opt/xslthl/highlighters/delphi-hl.xml" />
<highlighter id="ini" file="/Users/haad/Opt/xslthl/highlighters/ini-hl.xml" />
<highlighter id="php" file="/Users/haad/Opt/xslthl/highlighters/php-hl.xml" />
<highlighter id="myxml" file="/Users/haad/Opt/xslthl/highlighters/myxml-hl.xml" />
<highlighter id="m2" file="/Users/haad/Opt/xslthl/highlighters/m2-hl.xml" />
<highlighter id="tcl" file="/Users/haad/Opt/xslthl/highlighters/tcl-hl.xml" />
<highlighter id="c" file="/Users/haad/Opt/xslthl/highlighters/c-hl.xml" />
<highlighter id="cpp" file="/Users/haad/Opt/xslthl/highlighters/cpp-hl.xml" />
<highlighter id="csharp" file="/Users/haad/Opt/xslthl/highlighters/csharp-hl.xml" />
<highlighter id="python" file="/Users/haad/Opt/xslthl/highlighters/python-hl.xml" />
<highlighter id="ruby" file="/Users/haad/Opt/xslthl/highlighters/ruby-hl.xml" />
<highlighter id="perl" file="/Users/haad/Opt/xslthl/highlighters/perl-hl.xml" />
<highlighter id="javascript" file="/Users/haad/Opt/xslthl/highlighters/javascript-hl.xml" />
<namespace prefix="xslthl" uri="http://xslthl.sf.net" />
</xslthl-config>
I use -current snapshot of docbook-xsl style sheets with snapshot_8394 version number. It is post 1.74.2 build.

I'm trying to highlight this code from my document.

Code: Select all


          <programlisting language="c">
typedef struct auth_msg {
char msg_path[MAXPATHLEN]; /** Path to application */
uid_t msg_euid; /** Effective user id */
gid_t msg_egid; /** Effective group id */
pid_t msg_pid; /** Process id */
int msg_auth_status; /** Status of message after auth process */
} auth_msg_t;
</programlisting>
I use oxygen 10.1 with academic license. Do you have any idea what can be wrong or how can I debug it more ?

Re: xslthl not working

Posted: Fri Apr 03, 2009 6:08 pm
by sorin_ristache
Hello,

XSLTHL is enabled by default in the built-in Docbook transformation scenarios of Oxygen 10.1 (the current version). If you want to have syntax highlight in the PDF result or the HTML result of a Docbook transformation just insert your fragment that contains

Code: Select all

<programlisting language="c">
and apply one of the predefined Docbook scenarios or a scenario created by duplicating a predefined one. Oxygen includes a version of the XSLTHL jar file that works correctly with the Docbook stylesheets and the built-in XSLTHL config file already supports the C language.


Regards,
Sorin

Re: xslthl not working

Posted: Mon Apr 06, 2009 4:53 pm
by haad
I replaced my own xslthl with doxygen one, but programlisting code highlighting doesn't work still. I tested xslthl with original transformation scenario without my
own customisations without any success.

Re: xslthl not working

Posted: Mon Apr 06, 2009 5:06 pm
by sorin_ristache
Please send your Docbook XML file for which the program listing is not highlighted in the transformation output. What predefined scenario did you try?


Regards,
Sorin

Re: xslthl not working

Posted: Tue Apr 07, 2009 9:32 am
by haad
This is my testing xml file.

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article SYSTEM "file:/Users/haad/Opt/docbook-dtd/docbookx.dtd">
<article>
<title>TEST</title>
<section>
<title>test sec</title>
<para>foo</para>
<programlisting language="c">
/* comment */
int main(int argc, char **argv) {
// another c++ comment
int test;
printf("HEllo World\n");
return 0;
}
</programlisting>
</section>
</article>

I'm using Docbook PDF transformation scenario.

Re: xslthl not working

Posted: Wed Apr 08, 2009 12:17 pm
by sorin_ristache
There is a problem in the stylesheets and we will fix it in version 10.2. Please contact us for telling you how you can fix it in version 10.1.


Regards,
Sorin

Re: xslthl not working

Posted: Thu Apr 09, 2009 2:49 am
by haad
Ok I sent bug report. I hope that this will be addressed soon.

Re: xslthl not working

Posted: Thu Apr 09, 2009 9:30 am
by sorin_ristache
Hello haad,

I replied with a patch that should fix the highlight problem in the transformation output. The patch will be included also in Oxygen version 10.2.


Regards,
Sorin

Re: xslthl not working

Posted: Thu Apr 09, 2009 3:32 pm
by haad
thanks your patch fixes problem for me.