diff options
Diffstat (limited to 'xhtml/profile-docbook.xsl')
-rw-r--r-- | xhtml/profile-docbook.xsl | 114 |
1 files changed, 80 insertions, 34 deletions
diff --git a/xhtml/profile-docbook.xsl b/xhtml/profile-docbook.xsl index b5506d9..366532d 100644 --- a/xhtml/profile-docbook.xsl +++ b/xhtml/profile-docbook.xsl @@ -8,7 +8,7 @@ <xsl:output method="xml" encoding="UTF-8" indent="no" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/> <!-- ******************************************************************** - $Id: docbook.xsl 9396 2012-06-02 21:56:19Z bobstayton $ + $Id: docbook.xsl 9605 2012-09-18 10:48:54Z tom_schr $ ******************************************************************** This file is part of the XSL DocBook Stylesheet distribution. @@ -114,18 +114,69 @@ <!-- no apply-templates; make it empty except for dir for rtl--> </xsl:template> +<xsl:template name="head.content.base"> + <xsl:param name="node" select="."/> + <base href="{$html.base}"/> +</xsl:template> + +<xsl:template name="head.content.abstract"> + <xsl:param name="node" select="."/> + <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/> + <xsl:if test="$info and $info/abstract"> + <meta name="description"> + <xsl:attribute name="content"> + <xsl:for-each select="$info/abstract[1]/*"> + <xsl:value-of select="normalize-space(.)"/> + <xsl:if test="position() < last()"> + <xsl:text> </xsl:text> + </xsl:if> + </xsl:for-each> + </xsl:attribute> + </meta> + </xsl:if> +</xsl:template> + +<xsl:template name="head.content.link.made"> + <xsl:param name="node" select="."/> + + <link rev="made" href="{$link.mailto.url}"/> +</xsl:template> + +<xsl:template name="head.content.generator"> + <xsl:param name="node" select="."/> + <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/> +</xsl:template> + +<xsl:template name="head.content.style"> + <xsl:param name="node" select="."/> + <style type="text/css"><xsl:text> +body { background-image: url('</xsl:text> +<xsl:value-of select="$draft.watermark.image"/><xsl:text>'); + background-repeat: no-repeat; + background-position: top left; + /* The following properties make the watermark "fixed" on the page. */ + /* I think that's just a bit too distracting for the reader... */ + /* background-attachment: fixed; */ + /* background-position: center center; */ + }</xsl:text> + </style> +</xsl:template> + <xsl:template name="head.content"> <xsl:param name="node" select="."/> <xsl:param name="title"> <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/> </xsl:param> - <title> - <xsl:copy-of select="$title"/> - </title> + <xsl:call-template name="user.head.title"> + <xsl:with-param name="title" select="$title"/> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> <xsl:if test="$html.base != ''"> - <base href="{$html.base}"/> + <xsl:call-template name="head.content.base"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> </xsl:if> <!-- Insert links to CSS files or insert literal style elements --> @@ -144,39 +195,25 @@ </xsl:if> <xsl:if test="$link.mailto.url != ''"> - <link rev="made" href="{$link.mailto.url}"/> + <xsl:call-template name="head.content.link.made"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> </xsl:if> - <meta name="generator" content="DocBook {$DistroTitle} V{$VERSION}"/> + <xsl:call-template name="head.content.generator"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> <xsl:if test="$generate.meta.abstract != 0"> - <xsl:variable name="info" select="(articleinfo |bookinfo |prefaceinfo |chapterinfo |appendixinfo |sectioninfo |sect1info |sect2info |sect3info |sect4info |sect5info |referenceinfo |refentryinfo |partinfo |info |docinfo)[1]"/> - <xsl:if test="$info and $info/abstract"> - <meta name="description"> - <xsl:attribute name="content"> - <xsl:for-each select="$info/abstract[1]/*"> - <xsl:value-of select="normalize-space(.)"/> - <xsl:if test="position() < last()"> - <xsl:text> </xsl:text> - </xsl:if> - </xsl:for-each> - </xsl:attribute> - </meta> - </xsl:if> + <xsl:call-template name="head.content.abstract"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> </xsl:if> <xsl:if test="($draft.mode = 'yes' or ($draft.mode = 'maybe' and ancestor-or-self::*[@status][1]/@status = 'draft')) and $draft.watermark.image != ''"> - <style type="text/css"><xsl:text> -body { background-image: url('</xsl:text> -<xsl:value-of select="$draft.watermark.image"/><xsl:text>'); - background-repeat: no-repeat; - background-position: top left; - /* The following properties make the watermark "fixed" on the page. */ - /* I think that's just a bit too distracting for the reader... */ - /* background-attachment: fixed; */ - /* background-position: center center; */ - }</xsl:text> - </style> + <xsl:call-template name="head.content.style"> + <xsl:with-param name="node" select="$node"/> + </xsl:call-template> </xsl:if> <xsl:apply-templates select="." mode="head.keywords.content"/> </xsl:template> @@ -311,6 +348,15 @@ var popup_</xsl:text> <!-- This must not output any element content! --> </xsl:template> +<xsl:template name="user.head.title"> + <xsl:param name="node" select="."/> + <xsl:param name="title"/> + + <title> + <xsl:copy-of select="$title"/> + </title> +</xsl:template> + <xsl:template name="user.head.content"> <xsl:param name="node" select="."/> </xsl:template> @@ -364,7 +410,7 @@ Used by docbook.xsl, chunk-code.xsl and chunkfast.xsl --> <xsl:choose> <xsl:when test="$rootid != ''"> <xsl:choose> - <xsl:when test="count($profiled-nodes//*[@id=$rootid]) = 0"> + <xsl:when test="count($profiled-nodes//*[@id=$rootid or @xml:id=$rootid]) = 0"> <xsl:message terminate="yes"> <xsl:text>ID '</xsl:text> <xsl:value-of select="$rootid"/> @@ -376,9 +422,9 @@ Used by docbook.xsl, chunk-code.xsl and chunkfast.xsl --> <xsl:apply-templates select="key('id', $rootid)" mode="collect.targets"/> </xsl:if> <xsl:if test="$collect.xref.targets != 'only'"> - <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="process.root"/> + <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid or @xml:id=$rootid]" mode="process.root"/> <xsl:if test="$tex.math.in.alt != ''"> - <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid]" mode="collect.tex.math"/> + <xsl:apply-templates select="$profiled-nodes//*[@id=$rootid or @xml:id=$rootid]" mode="collect.tex.math"/> </xsl:if> </xsl:if> </xsl:otherwise> |