[PATCH sgml-doctools 3/4] Embed CSS styles inside the HTML HEAD element
Gaetan Nadon
memsize at videotron.ca
Fri Sep 9 12:23:30 PDT 2011
Rather than referring to the external xorg.css stylesheet, embed the content
of the file in the html output produced. This is accomplished by adding
an xsl:template to the customization layer. The content of xorg.css must not
be encoded due to the '<' character.
This makes the whole html docs tree much more relocatable.
In addition, it eliminates xorg.css as a runtime file which makes
xorg-sgml-doctools a build time only package.
Signed-off-by: Gaetan Nadon <memsize at videotron.ca>
---
xorg-chunk.xsl | 11 ++++++++++-
xorg-xhtml.xsl | 11 ++++++++++-
xorg.css | 6 +-----
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/xorg-chunk.xsl b/xorg-chunk.xsl
index 3d85c6f..93b18b5 100644
--- a/xorg-chunk.xsl
+++ b/xorg-chunk.xsl
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY xorgcss SYSTEM "xorg.css">
+]>
<!--
X.Org DocBook/XML customization
@@ -10,6 +12,13 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/chunk.xsl"/>
+<!-- Embedding CSS styles http://www.sagehill.net/docbookxsl/HtmlHead.html#EmbedCSS -->
+<xsl:template name="user.head.content">
+<style type="text/css">
+<xsl:text disable-output-escaping="yes">&xorgcss;</xsl:text>
+</style>
+</xsl:template>
+
<!-- Reference Pages HTML/FO Parameters -->
<!-- The formatting of a function element will include generated parentheses -->
diff --git a/xorg-xhtml.xsl b/xorg-xhtml.xsl
index fc2e95d..d9b7b3e 100644
--- a/xorg-xhtml.xsl
+++ b/xorg-xhtml.xsl
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
-
+<!DOCTYPE xsl:stylesheet [
+<!ENTITY xorgcss SYSTEM "xorg.css">
+]>
<!--
X.Org DocBook/XML customization
@@ -10,6 +12,13 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version='1.0'>
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"/>
+<!-- Embedding CSS styles http://www.sagehill.net/docbookxsl/HtmlHead.html#EmbedCSS -->
+<xsl:template name="user.head.content">
+<style type="text/css">
+<xsl:text disable-output-escaping="yes">&xorgcss;</xsl:text>
+</style>
+</xsl:template>
+
<!-- Reference Pages HTML/FO Parameters -->
<!-- The formatting of a function element will include generated parentheses -->
diff --git a/xorg.css b/xorg.css
index 0b7fcda..278ed7f 100644
--- a/xorg.css
+++ b/xorg.css
@@ -69,13 +69,9 @@ body {
}
/*
- * <!DOCTYPE book PUBLIC ... >
- *
* Books have a title page, a preface, some chapters and appendices,
* a glossary, an index and a bibliography, in that order.
*
- * <!DOCTYPE article PUBLIC ... >
- *
* An Article has no preface and no chapters. It has sections, appendices,
* a glossary, an index and a bibliography.
*/
@@ -255,7 +251,7 @@ div.bibliography>div.titlepage h2.title {
/*
* Selection: variable lists, informal tables and tables
*
- * Note the <xsl:param name="variablelist.as.table" select="1"/> in xorg-xhtml.xsl
+ * Note the parameter name "variablelist.as.table" in xorg-xhtml.xsl
* A table with rows and columns is constructed inside div.variablelist
*
* Set the left margin so it is indented to the right
--
1.7.4.1
More information about the xorg-devel
mailing list