Saxon 9.4.0.6 EE with xslthl
Posted: Mon Apr 29, 2013 1:30 pm
Hello everybody,
I am trying to use qwdita.highlight plugin with Oxygen 14.2. This plugin is based on xslthl tool. I am trying to use it to highlight blocks of source code in DITA documents. After installation of plugin I faced the following problem: saxon 9.4.0.6 EE does not see Java-functions exported by xslthl (<xsl:when test="function-available('XXX:highlight')"> always returns false). The following code prints "NO FUNCS!!!" message if I use saxon 9.4, but if I configure to use saxon6.5.5 (as it is done by default in docbook framework) everything works, "s6hl:highlight!!!" is printed and XHTML transformation produces html with highlighted source code.
And I would be happy but I need also to produce highlighted code in PDFs. With PDF transform "saxon6.5.5" trick does not work, because as I understand this transformation requires XSLT2.0 transformer. So I think I have to make xslthl working with saxon 9.4.0.6 EE. Could anybody give me a hint, how can I make Java-functions exported by xslthl visible to saxon 9.4.0.6 EE?
Regards
Alexey
I am trying to use qwdita.highlight plugin with Oxygen 14.2. This plugin is based on xslthl tool. I am trying to use it to highlight blocks of source code in DITA documents. After installation of plugin I faced the following problem: saxon 9.4.0.6 EE does not see Java-functions exported by xslthl (<xsl:when test="function-available('XXX:highlight')"> always returns false). The following code prints "NO FUNCS!!!" message if I use saxon 9.4, but if I configure to use saxon6.5.5 (as it is done by default in docbook framework) everything works, "s6hl:highlight!!!" is printed and XHTML transformation produces html with highlighted source code.
And I would be happy but I need also to produce highlighted code in PDFs. With PDF transform "saxon6.5.5" trick does not work, because as I understand this transformation requires XSLT2.0 transformer. So I think I have to make xslthl working with saxon 9.4.0.6 EE. Could anybody give me a hint, how can I make Java-functions exported by xslthl visible to saxon 9.4.0.6 EE?
Code: Select all
<!--
All of this code was taken from: http://xslthl.wiki.sourceforge.net/Usage
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s6hl="http://net.sf.xslthl/ConnectorSaxon6"
xmlns:sbhl="http://net.sf.xslthl/ConnectorSaxonB"
xmlns:xhl="http://net.sf.xslthl/ConnectorXalan"
xmlns:saxon6="http://icl.com/saxon"
xmlns:saxonb="http://saxon.sf.net/"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:xslthl="http://xslthl.sf.net"
extension-element-prefixes="s6hl sbhl xhl xslthl"
>
<!-- exclude-result-prefixes="xslthl s6hl sbhl xhl" -->
<!-- for Xalan 2.7 -->
<xalan:component prefix="xhl" functions="highlight">
<xalan:script lang="javaclass" src="xalan://net.sf.xslthl.ConnectorXalan" />
</xalan:component>
<!-- for saxon 6 -->
<saxon6:script implements-prefix="s6hl" language="java"
src="java:net.sf.xslthl.ConnectorSaxon6" />
<!-- for saxon 8.5 and later -->
<saxonb:script implements-prefix="sbhl" language="java"
src="java:net.sf.xslthl.ConnectorSaxonB" />
<xsl:template name="syntax-highlight">
<xsl:param name="language" />
<xsl:param name="source" />
<xsl:param name="config"></xsl:param>
<xsl:choose>
<xsl:when test="function-available('sbhl:highlight')">
<xsl:message>sbhl:highlight!!!</xsl:message>
<xsl:variable name="highlighted" select="sbhl:highlight($language, $source, $config)" />
<xsl:apply-templates select="$highlighted" />
</xsl:when>
<xsl:when test="function-available('s6hl:highlight')">
<xsl:message>s6hl:highlight!!!</xsl:message>
<xsl:variable name="highlighted" select="s6hl:highlight($language, $source, $config)" />
<xsl:apply-templates select="$highlighted" />
</xsl:when>
<xsl:when test="function-available('xhl:highlight')">
<xsl:message>xhl:highlight!!!</xsl:message>
<xsl:variable name="highlighted" select="xhl:highlight($language, $source, $config)" />
<xsl:apply-templates select="$highlighted" />
</xsl:when>
<xsl:otherwise>
<xsl:message>NO FUNCS!!!</xsl:message>
<xsl:apply-templates select="$source/*|$source/text()" />
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Alexey