summaryrefslogtreecommitdiff
path: root/xhtml5
diff options
context:
space:
mode:
authorKévin THIERRY <kevin.thierry@open.eurogiciel.org>2014-11-06 11:50:51 +0100
committerKévin THIERRY <kevin.thierry@open.eurogiciel.org>2014-11-06 11:50:51 +0100
commit14b660c1b43c74e8db2abb51e38e7a1aa38220a2 (patch)
treef78a8637465b7a4c9624fef03d27eb7aeaa779d4 /xhtml5
parentb2d73bee5e123c5e69352a447d4bc318132612d9 (diff)
downloaddocbook-xsl-stylesheets-14b660c1b43c74e8db2abb51e38e7a1aa38220a2.tar.gz
docbook-xsl-stylesheets-14b660c1b43c74e8db2abb51e38e7a1aa38220a2.tar.bz2
docbook-xsl-stylesheets-14b660c1b43c74e8db2abb51e38e7a1aa38220a2.zip
Imported Upstream version 1.78.1upstream/1.78.1
Diffstat (limited to 'xhtml5')
-rw-r--r--xhtml5/html5-element-mods.xsl37
-rw-r--r--xhtml5/xhtml-docbook.xsl108
2 files changed, 104 insertions, 41 deletions
diff --git a/xhtml5/html5-element-mods.xsl b/xhtml5/html5-element-mods.xsl
index 9aae285..f3cb2d1 100644
--- a/xhtml5/html5-element-mods.xsl
+++ b/xhtml5/html5-element-mods.xsl
@@ -336,16 +336,25 @@
<!-- HTML5: converts obsolete HTML attributes to CSS styles -->
<xsl:template match="*" mode="convert.to.style">
+ <xsl:variable name="element" select="local-name(.)"/>
+
<xsl:variable name="style.from.atts">
<xsl:for-each select="@*">
<xsl:choose>
- <xsl:when test="local-name() = 'width'">
+ <!-- width and height attributes are ok for img element -->
+ <xsl:when test="local-name() = 'width' and $element != 'img'">
<xsl:text>width: </xsl:text>
<xsl:value-of select="."/>
<xsl:text>; </xsl:text>
</xsl:when>
+ <xsl:when test="local-name() = 'height' and $element != 'img'">
+ <xsl:text>height </xsl:text>
+ <xsl:value-of select="."/>
+ <xsl:text>; </xsl:text>
+ </xsl:when>
+
<xsl:when test="local-name() = 'align'">
<xsl:text>text-align: </xsl:text>
<xsl:value-of select="."/>
@@ -395,15 +404,23 @@
<xsl:value-of select="$style"/>
</xsl:attribute>
</xsl:if>
- <!-- Also skip disallowed summary attributes -->
- <xsl:copy-of select="@*[local-name(.) != 'width' and
- local-name(.) != 'summary' and
- local-name(.) != 'border' and
- local-name(.) != 'cellspacing' and
- local-name(.) != 'cellpadding' and
- local-name(.) != 'style' and
- local-name(.) != 'align' and
- local-name(.) != 'valign']"/>
+ <!-- skip converted atts, and also skip disallowed summary attribute -->
+ <xsl:for-each select="@*">
+ <xsl:choose>
+ <xsl:when test="local-name(.) = 'width' and $element != 'img'"/>
+ <xsl:when test="local-name(.) = 'height' and $element != 'img'"/>
+ <xsl:when test="local-name(.) = 'summary'"/>
+ <xsl:when test="local-name(.) = 'border'"/>
+ <xsl:when test="local-name(.) = 'cellspacing'"/>
+ <xsl:when test="local-name(.) = 'cellpadding'"/>
+ <xsl:when test="local-name(.) = 'style'"/>
+ <xsl:when test="local-name(.) = 'align'"/>
+ <xsl:when test="local-name(.) = 'valign'"/>
+ <xsl:otherwise>
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
<xsl:apply-templates mode="convert.to.style"/>
</xsl:element>
</xsl:template>
diff --git a/xhtml5/xhtml-docbook.xsl b/xhtml5/xhtml-docbook.xsl
index e14f054..93c2df7 100644
--- a/xhtml5/xhtml-docbook.xsl
+++ b/xhtml5/xhtml-docbook.xsl
@@ -9,7 +9,7 @@
<xslo:output xmlns:xslo="http://www.w3.org/1999/XSL/Transform" method="xml" encoding="UTF-8" indent="no"/>
<!-- ********************************************************************
- $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.
@@ -115,18 +115,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() &lt; 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 -->
@@ -145,39 +196,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() &lt; 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>
@@ -312,6 +349,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>