← Prev in month ← Prev in thread

Syntax highlighting - setting colours

From
John Brown <>
Date
2013-04-16T16:36:33+00:00
ID
Thread
Syntax highlighting - setting colours
Hello All,

It seems that by default, keywords are bold. In addition to that,
I want to make keywords blue and comments green. I copied the code
to do it from
http://www.sagehill.net/docbookxsl/SyntaxHighlighting.html,
but it is not working. The text in the program listing is bold
but black.

My customisation layer looks like this:


  <?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:fo="http://www.w3.org/1999/XSL/Format"
    xmlns:xslthl="http://xslthl.sf.net"
    exclude-result-prefixes="xslthl">

  <xsl:import href="file:///c:/mingw/local/share/docbook-xsl-ns-1.78.1/fo/docbook.xsl" />
  <xsl:import href="file:///c:/mingw/local/share/docbook-xsl-ns-1.78.1/fo/highlight.xsl" />
  <xsl:param name="highlight.source" select="1"/>

  <xsl:template match="xslthl:keyword">
  <fo:inline font-weight="bold" color="blue"><xsl:apply-templates/></fo:inline>
</xsl:template>

<xsl:template match="xslthl:comment">
  <fo:inline font-style="italic" color="green"><xsl:apply-templates/></fo:inline>
</xsl:template>
  
</xsl:stylesheet>


The relevant section of my DocBook 5.0 "sub-document" (XIncluded in main
document notes.xml) is

<programlisting language="sql92">
...
</programlisting>

I transform notes.xml like this:

xmllint --xinclude -o notesi.xml notes.xml

%JAVA% -cp %CLASSPATH% -Dxslthl.config=/path/to/xslthl-config.xml com.icl.saxon.Stylesheet -o notes.fo notesi.xml notes.xsl

%FOP% notes.fo notes.pdf

What am I doing wrong?

Regards,
John Brown.
← Prev in month ← Prev in thread