handle admonitions and filerefs

[SVN r25629]
This commit is contained in:
Aleksey Gurtovoy 2004-10-08 23:03:02 +00:00
parent 7e44d4d267
commit c678a081a3
4 changed files with 59 additions and 3 deletions

27
xsl/admon.xsl Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/admon.xsl"/>
<xsl:import href="relative-href.xsl"/>
<xsl:template name="admon.graphic">
<xsl:param name="node" select="."/>
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="$admon.graphics.path"/>
</xsl:call-template>
<xsl:choose>
<xsl:when test="local-name($node)='note'">note</xsl:when>
<xsl:when test="local-name($node)='warning'">warning</xsl:when>
<xsl:when test="local-name($node)='caution'">caution</xsl:when>
<xsl:when test="local-name($node)='tip'">tip</xsl:when>
<xsl:when test="local-name($node)='important'">important</xsl:when>
<xsl:otherwise>note</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="$admon.graphics.extension"/>
</xsl:template>
</xsl:stylesheet>

View File

@ -76,4 +76,30 @@
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<!-- ====================================================================== -->
<xsl:template match="@fileref">
<xsl:choose>
<xsl:when test="contains(., ':')">
<xsl:value-of select="."/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="target_uri">
<xsl:call-template name="relative-uri">
<xsl:with-param name="destdir">
<xsl:call-template name="dbhtml-dir">
<xsl:with-param name="context" select=".."/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:variable>
<xsl:call-template name="href.target.relative">
<xsl:with-param name="target" select="$target_uri"/>
<xsl:with-param name="context" select=".."/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

View File

@ -10,6 +10,7 @@
<xsl:import href="chunk-common.xsl"/> <xsl:import href="chunk-common.xsl"/>
<xsl:import href="docbook-layout.xsl"/> <xsl:import href="docbook-layout.xsl"/>
<xsl:import href="navbar.xsl"/> <xsl:import href="navbar.xsl"/>
<xsl:import href="admon.xsl"/>
<xsl:import href="relative-href.xsl"/> <xsl:import href="relative-href.xsl"/>
<xsl:param name="html.stylesheet" select="'boostbook.css'"/> <xsl:param name="html.stylesheet" select="'boostbook.css'"/>

View File

@ -2,17 +2,19 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"> version="1.0">
<xsl:import <xsl:import href="http://docbook.sourceforge.net/release/xsl/current/lib/lib.xsl"/>
href="http://docbook.sourceforge.net/release/xsl/current/lib/lib.xsl"/>
<!-- ==================================================================== --> <!-- ==================================================================== -->
<xsl:template name="href.target.relative"> <xsl:template name="href.target.relative">
<xsl:param name="target"/> <xsl:param name="target"/>
<xsl:param name="context" select="."/>
<xsl:variable name="href.to.uri" select="$target"/> <xsl:variable name="href.to.uri" select="$target"/>
<xsl:variable name="href.from.uri"> <xsl:variable name="href.from.uri">
<xsl:call-template name="href.target.uri"/> <xsl:call-template name="href.target.uri">
<xsl:with-param name="object" select="$context"/>
</xsl:call-template>
</xsl:variable> </xsl:variable>
<xsl:variable name="href.to"> <xsl:variable name="href.to">