Jitterbug no more.
[fvwm.git] / doc / docbook-xsl / highlighting / common.xsl
blob58cc98c22967979d50732da8a43748c8a907be4c
1 <?xml version='1.0'?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:hl="java:net.sf.xslthl.ConnectorSaxon6"
4 xmlns:exsl="http://exslt.org/common"
5 exclude-result-prefixes="exsl hl"
6 version='1.0'>
8 <!-- ********************************************************************
9 $Id: common.xsl,v 1.1 2007/03/10 05:15:13 scott Exp $
10 ********************************************************************
12 This file is part of the XSL DocBook Stylesheet distribution.
13 See ../README or http://nwalsh.com/docbook/xsl/ for copyright
14 and other information.
16 ******************************************************************** -->
18 <!-- You can override this template to do more complex mapping of
19 language attribute to highlighter language ID (see xslthl-config.xml) -->
20 <xsl:template name="language.to.xslthl">
21 <xsl:param name="context"/>
23 <xsl:choose>
24 <xsl:when test="$context/@language != ''">
25 <xsl:value-of select="$context/@language"/>
26 </xsl:when>
27 <xsl:when test="$highlight.default.language != ''">
28 <xsl:value-of select="$highlight.default.language"/>
29 </xsl:when>
30 </xsl:choose>
31 </xsl:template>
33 <xsl:template name="apply-highlighting">
34 <xsl:choose>
35 <!-- Do we want syntax highlighting -->
36 <xsl:when test="$highlight.source != 0 and function-available('hl:highlight')">
37 <xsl:variable name="language">
38 <xsl:call-template name="language.to.xslthl">
39 <xsl:with-param name="context" select="."/>
40 </xsl:call-template>
41 </xsl:variable>
42 <xsl:choose>
43 <xsl:when test="$language != ''">
44 <xsl:variable name="content">
45 <xsl:apply-templates/>
46 </xsl:variable>
47 <xsl:apply-templates select="hl:highlight($language, exsl:node-set($content))"/>
48 </xsl:when>
49 <xsl:otherwise>
50 <xsl:apply-templates/>
51 </xsl:otherwise>
52 </xsl:choose>
53 </xsl:when>
54 <!-- No syntax highlighting -->
55 <xsl:otherwise>
56 <xsl:apply-templates/>
57 </xsl:otherwise>
58 </xsl:choose>
59 </xsl:template>
61 </xsl:stylesheet>