docbook-apps

XSLT Syntax Highlighting 2.0 (xslthl) released

  • 1.  XSLT Syntax Highlighting 2.0 (xslthl) released

    Posted 07-30-2008 20:03
    xslthl provides an XSLT extension for Java based XSLT processors that
    allows you to add syntax highlighting to text nodes. It can be used with
    DocBook XSL to produce syntax highlighted program listings in the HTML
    and FO targets.


    xslthl 2.0 contains a lot of new features and improvements over the
    previous 1.3 version:

    - support for Saxon 8.5+ and Xalan 2.7. The previous version only
    supported Saxon 6.5.
    - more recognizes languages, highlighter configurations are included for
    the following languages: Java, ini files, PHP, Pascal/Delphi, XML
    files, Modula 2, C, C#, C++, Tcl, Perl, Python, Ruby, JavaScript. (the
    first 5 were also included in the previous releases)
    - improved functionality for highlighter configurations (for adding new
    supported languages)
    - the location of the xslthl configuration can be passed as the 3rd
    argument of the XSLT function (no longer required to set java system
    properties).
    - the "language identifier" (1st argument for the XSLT function), can
    also be a location to a language highlighter configuration.
    - only text nodes passed to the highlight XSLT function will be
    highlighted, element nodes will be pass through to the
    result. Previously these elements were discarded and thereby breaking
    DocBook's <co /> element within program listings. This change also
    allows you to combine different language highlighters (for example to
    highlight HTML with embedded PHP code).


    Version 2.0 of xslthl can be downloaded from the sourceforge.net project
    page:
    http://sourceforge.net/project/platformdownload.php?group_id=153524


    Information on how to use this (in general) can be found in the xslthl
    wiki:
    http://xslthl.wiki.sourceforge.net/
    Every feature of xslthl 2.0 is/should be documented in that wiki.


    Note!: xslthl 2.0 does not work out of the box with DocBook XSL 1.74 or
    earlier. Various changes are needed to the DocBook XSL files for it to
    work. These changes are already present in the DocBook XSL subversion
    repository. More information about this can be found in the xslthl wiki:
    http://xslthl.wiki.sourceforge.net/DocBook+XSL+Updates

    An archive with updated files for DocBook 1.74 can be downloaded here:
    http://sourceforge.net/project/showfiles.php?group_id=153524&package_id=285873&release_id=616393

    PS, note that the way the xslthl elements are processed has been
    changed, if you previously changed that behavior in a custom stylesheet
    you need to apply the same changes (add mode="xslthl" to the custom xslt
    templates).


    An example of what you can do with xslthl 2.0 and docbook-xsl can be
    seen here:
    http://xslthl.sourceforge.net/examples/sample-article.html


    --
    Michiel "elmuerte" Hendriks elmuerte@drunksnipers.com
    http://elmuerte.com
    BibTeX to Docbook 5 http://sf.net/projects/bib2db5
    xslthl 2.x http://sf.net/projects/xslthl