This section explains how you can automatically colorize the
source code contained in <pre>
,
<codeblock>
or any other element specializing
<pre>
.
<pre>
, <codeblock>
or any
other element specializing <pre>
. This feature,
commonly called syntax highlighting, has been implemented
using an open source software component called "XSLT
syntax highlighting ".@outputclass
to a
<pre>
, <codeblock>
or any
other element specializing <pre>
. The value of
attribute @outputclass
must be any of:
language-bourne
(or -shell
or
-sh
), language-c
,
language-cmake
(or -make
or
-makefile
), language-cpp
,
language-csharp
, language-css21
(or
-css
), language-delphi
,
language-ini
, language-java
,
language-javascript
, language-lua
,
language-m2
(Modula 2), language-perl
,
language-php
, language-python
,
language-ruby
, language-sql1999
,
language-sql2003
, language-sql92
(or
-sql
), language-tcl
,
language-upc
(Unified Parallel C),
language-html
, language-xml
..hl-keyword
(keywords of a programming
language),.hl-string
(string literal),.hl-number
(number literal),.hl-comment
(any type of comment),.hl-doccomment
(comments used as documentation,
i.e. javadoc, or xmldoc),.hl-directive
(preprocessor directive or in XML, a
processing-instruction),.hl-annotation
(annotations or "attributes" as they
are called in .NET),.hl-tag
(XML tag, i.e. element name),.hl-attribute
(XML attribute name),.hl-value
(XML attribute value),.hl-doctype
(<!DOCTYPE>
and
all its content)..hl-keyword { font-weight: bold; color: #602060; }
<attribute-set>
s: hl-keyword,
hl-string, hl-number, hl-comment,
hl-doccomment, hl-directive, hl-annotation,
hl-tag, hl-attribute, hl-value,
hl-doctype.<xsl:attribute-set name="hl-keyword" use-attribute-sets="hl-style"> <xsl:attribute name="font-weight">bold</xsl:attribute> <xsl:attribute name="color">#602060</xsl:attribute> </xsl:attribute-set>
‣ Parent topic: Chapter 7. Fancy code blocks