highlight.source.xml 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <refentry xmlns="http://docbook.org/ns/docbook"
  2. xmlns:xlink="http://www.w3.org/1999/xlink"
  3. xmlns:xi="http://www.w3.org/2001/XInclude"
  4. xmlns:src="http://nwalsh.com/xmlns/litprog/fragment"
  5. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  6. version="5.0" xml:id="highlight.source">
  7. <refmeta>
  8. <refentrytitle>highlight.source</refentrytitle>
  9. <refmiscinfo class="other" otherclass="datatype">boolean</refmiscinfo>
  10. </refmeta>
  11. <refnamediv>
  12. <refname>highlight.source</refname>
  13. <refpurpose>Should the content of <tag>programlisting</tag>
  14. be syntactically highlighted?</refpurpose>
  15. </refnamediv>
  16. <refsynopsisdiv>
  17. <src:fragment xml:id="highlight.source.frag">
  18. <xsl:param name="highlight.source" select="0"/>
  19. </src:fragment>
  20. </refsynopsisdiv>
  21. <refsection><info><title>Description</title></info>
  22. <para>When this parameter is non-zero, the stylesheets will try to do syntax highlighting of the
  23. content of <tag>programlisting</tag> elements. You specify the language for each programlisting
  24. by using the <tag class="attribute">language</tag> attribute. The <parameter>highlight.default.language</parameter>
  25. parameter can be used to specify the language for programlistings without a <tag class="attribute">language</tag>
  26. attribute. Syntax highlighting also works for <tag>screen</tag> and <tag>synopsis</tag> elements.</para>
  27. <para>The actual highlighting work is done by the XSLTHL extension module. This is an external Java library that has to be
  28. downloaded separately (see below).</para>
  29. <itemizedlist>
  30. <para>In order to use this extension, you must</para>
  31. <listitem><para>add <filename>xslthl-2.x.x.jar</filename> to your Java classpath. The latest version is available
  32. from <link xlink:href="http://sourceforge.net/projects/xslthl">the XSLT syntax highlighting project</link>
  33. at SourceForge.</para>
  34. </listitem>
  35. <listitem>
  36. <para>use a customization layer in which you import one of the following stylesheet modules:
  37. <itemizedlist>
  38. <listitem>
  39. <para><filename>html/highlight.xsl</filename>
  40. </para>
  41. </listitem>
  42. <listitem>
  43. <para><filename>xhtml/highlight.xsl</filename>
  44. </para>
  45. </listitem>
  46. <listitem>
  47. <para><filename>xhtml-1_1/highlight.xsl</filename>
  48. </para>
  49. </listitem>
  50. <listitem>
  51. <para><filename>fo/highlight.xsl</filename>
  52. </para>
  53. </listitem>
  54. </itemizedlist>
  55. </para>
  56. </listitem>
  57. <listitem><para>let either the <literal>xslthl.config</literal> Java system property or the
  58. <parameter>highlight.xslthl.config</parameter> parameter point to the configuration file for syntax
  59. highlighting (using URL syntax). DocBook XSL comes with a ready-to-use configuration file,
  60. <filename>highlighting/xslthl-config.xml</filename>.</para>
  61. </listitem>
  62. </itemizedlist>
  63. <para>The extension works with Saxon 6.5.x and Xalan-J. (Saxon 8.5 or later is also supported, but since it is
  64. an XSLT 2.0 processor it is not guaranteed to work with DocBook XSL in all circumstances.)</para>
  65. <para>The following is an example of a Saxon 6 command adapted for syntax highlighting, to be used on Windows:</para>
  66. <informalexample>
  67. <para><command>java -cp c:/Java/saxon.jar;c:/Java/xslthl-2.0.1.jar
  68. -Dxslthl.config=file:///c:/docbook-xsl/highlighting/xslthl-config.xml com.icl.saxon.StyleSheet
  69. -o test.html test.xml myhtml.xsl</command></para>
  70. </informalexample>
  71. </refsection>
  72. </refentry>