2
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
xmlns:s6hl="http://net.sf.xslthl/ConnectorSaxon6"
5
xmlns:sbhl="http://net.sf.xslthl/ConnectorSaxonB"
6
xmlns:xhl="http://net.sf.xslthl/ConnectorXalan"
7
xmlns:saxon6="http://icl.com/saxon"
8
xmlns:saxonb="http://saxon.sf.net/"
9
xmlns:xalan="http://xml.apache.org/xalan"
11
xmlns:exsl="http://exslt.org/common"
12
xmlns:xslthl="http://xslthl.sf.net"
13
exclude-result-prefixes="exsl xslthl s6hl sbhl xhl"
16
<!-- ********************************************************************
17
$Id: common.xsl 8257 2009-02-20 04:40:16Z abdelazer $
18
********************************************************************
20
This file is part of the XSL DocBook Stylesheet distribution.
21
See ../README or http://docbook.sf.net/release/xsl/current/ for
22
and other information.
24
******************************************************************** -->
26
<!-- this construction is needed to have the saxon and xalan connectors working alongside each other -->
27
<xalan:component prefix="xhl" functions="highlight">
28
<xalan:script lang="javaclass" src="xalan://net.sf.xslthl.ConnectorXalan" />
32
<saxon6:script implements-prefix="s6hl" language="java" src="java:net.sf.xslthl.ConnectorSaxon6" />
34
<!-- for saxon 8.5 and later -->
35
<saxonb:script implements-prefix="sbhl" language="java" src="java:net.sf.xslthl.ConnectorSaxonB" />
38
<!-- You can override this template to do more complex mapping of
39
language attribute to highlighter language ID (see xslthl-config.xml) -->
40
<xsl:template name="language.to.xslthl">
41
<xsl:param name="context"/>
44
<xsl:when test="$context/@language != ''">
45
<xsl:value-of select="$context/@language"/>
47
<xsl:when test="$highlight.default.language != ''">
48
<xsl:value-of select="$highlight.default.language"/>
53
<xsl:template name="apply-highlighting">
55
<!-- Do we want syntax highlighting -->
56
<xsl:when test="$highlight.source != 0">
57
<xsl:variable name="language">
58
<xsl:call-template name="language.to.xslthl">
59
<xsl:with-param name="context" select="."/>
63
<xsl:when test="$language != ''">
64
<xsl:variable name="content">
65
<xsl:apply-templates/>
68
<xsl:when test="function-available('s6hl:highlight')">
69
<xsl:apply-templates select="s6hl:highlight($language, exsl:node-set($content), $highlight.xslthl.config)"
72
<xsl:when test="function-available('sbhl:highlight')">
73
<xsl:apply-templates select="sbhl:highlight($language, exsl:node-set($content), $highlight.xslthl.config)"
76
<xsl:when test="function-available('xhl:highlight')">
77
<xsl:apply-templates select="xhl:highlight($language, exsl:node-set($content), $highlight.xslthl.config)"
81
<xsl:copy-of select="$content"/>
86
<xsl:apply-templates/>
90
<!-- No syntax highlighting -->
92
<xsl:apply-templates/>
97
<!-- A fallback when the specific style isn't recognized -->
98
<xsl:template match="xslthl:*" mode="xslthl">
100
<xsl:text>unprocessed xslthl style: </xsl:text>
101
<xsl:value-of select="local-name(.)" />
103
<xsl:apply-templates mode="xslthl"/>
106
<!-- Copy over already produced markup (FO/HTML) -->
107
<xsl:template match="node()" mode="xslthl" priority="-1">
109
<xsl:apply-templates select="node()" mode="xslthl"/>
113
<xsl:template match="*" mode="xslthl">
115
<xsl:copy-of select="@*"/>
116
<xsl:apply-templates select="node()" mode="xslthl"/>