[yelp] [info2html.xsl.in] Use the new common HTML output templates



commit f2658f0cc97b732f8fabf8b3227624d72420333a
Author: Shaun McCance <shaunm gnome org>
Date:   Tue Jun 1 10:58:00 2010 -0500

    [info2html.xsl.in] Use the new common HTML output templates

 configure.ac                 |   12 ++--
 stylesheets/info2html.xsl.in |  173 +++++++++++++++++++-----------------------
 2 files changed, 84 insertions(+), 101 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 943bbbf..c7854a0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -131,12 +131,12 @@ AC_SUBST(XSL_DB2XHTML)
 XSL_MAL2XHTML="`$PKG_CONFIG --variable=mal2xhtml yelp-xsl`"
 AC_SUBST(XSL_MAL2XHTML)
 
-XSL_THEME_COLORS="`$PKG_CONFIG --variable=xsltdir yelp-xsl`/theme/theme-colors.xsl"
-AC_SUBST(XSL_THEME_COLORS)
-XSL_THEME_ICONS="`$PKG_CONFIG --variable=xsltdir yelp-xsl`/theme/theme-icons.xsl"
-AC_SUBST(XSL_THEME_ICONS)
-XSL_THEME_HTML="`$PKG_CONFIG --variable=xsltdir yelp-xsl`/theme/theme-html.xsl"
-AC_SUBST(XSL_THEME_HTML)
+XSL_COLOR="`$PKG_CONFIG --variable=xsltdir yelp-xsl`/common/color.xsl"
+AC_SUBST(XSL_COLOR)
+XSL_ICONS="`$PKG_CONFIG --variable=xsltdir yelp-xsl`/common/icons.xsl"
+AC_SUBST(XSL_ICONS)
+XSL_HTML="`$PKG_CONFIG --variable=xsltdir yelp-xsl`/common/html.xsl"
+AC_SUBST(XSL_HTML)
 
 XSL_GETTEXT="`$PKG_CONFIG --variable=gettext yelp-xsl`"
 AC_SUBST(XSL_GETTEXT)
diff --git a/stylesheets/info2html.xsl.in b/stylesheets/info2html.xsl.in
index 9482aa2..ec75878 100644
--- a/stylesheets/info2html.xsl.in
+++ b/stylesheets/info2html.xsl.in
@@ -7,9 +7,9 @@
                 version="1.0">
 
 <xsl:import href="@XSL_GETTEXT@"/>
-<xsl:import href="@XSL_THEME_COLORS@"/>
-<xsl:import href="@XSL_THEME_ICONS@"/>
-<xsl:import href="@XSL_THEME_HTML@"/>
+<xsl:import href="@XSL_COLOR@"/>
+<xsl:import href="@XSL_ICONS@"/>
+<xsl:import href="@XSL_HTML@"/>
 <xsl:include href="yelp-common.xsl"/>
 
 <xsl:template name="linktrails">
@@ -26,58 +26,85 @@
   <xsl:text>&#x00A0;» </xsl:text>
 </xsl:template>
 
-<xsl:template match="/Info">
-  <xsl:apply-templates select="Section"/>
+<xsl:template match="/">
+  <xsl:for-each select="/Info/Section">
+    <xsl:call-template name="html.output"/>
+  </xsl:for-each>
 </xsl:template>
 
-<xsl:template match="Section">
-  <yelp:document href="{ id}">
-    <html>
-      <head>
-        <title>
-          <xsl:value-of select="@name"/>
-        </title>
-        <style type="text/css">
-          <xsl:call-template name="html.css"/>
-        </style>
-      </head>
-      <body>
-        <div class="head">
-          <xsl:if test="@up">
-            <div class="trails">
-              <div class="trail">
-                <xsl:call-template name="linktrails"/>
-              </div>
-            </div>
-          </xsl:if>
-        </div>
-        <div class="body">
-          <div class="navbar">
-            <xsl:variable name="preceding" select="preceding::Section[1]"/>
-            <xsl:variable name="following" select="(Section[1] | following::Section[1])[1]"/>
-            <xsl:if test="$preceding">
-              <a class="navbar-prev" href="xref:{$preceding/@id}">
-                <xsl:value-of select="$preceding/@name"/>
-              </a>
-            </xsl:if>
-            <xsl:if test="$preceding and $following">
-              <xsl:text>&#x00A0;&#x00A0;|&#x00A0;&#x00A0;</xsl:text>
-            </xsl:if>
-            <xsl:if test="$following">
-              <a class="navbar-next" href="xref:{$following/@id}">
-                <xsl:value-of select="$following/@name"/>
-              </a>
-            </xsl:if>
-          </div>
-          <xsl:apply-templates select="node()[not(self::Section)]"/>
-        </div>
-        <div class="foot"/>
-      </body>
-    </html>
-  </yelp:document>
-  <xsl:apply-templates select="Section"/>
+<xsl:template mode="html.output.after.mode" match="Section">
+  <xsl:for-each select="Section">
+    <xsl:call-template name="html.output"/>
+  </xsl:for-each>
 </xsl:template>
 
+<xsl:template mode="html.title.mode" match="Section">
+  <xsl:value-of select="@name"/>
+</xsl:template>
+
+<xsl:template mode="html.css.mode" match="Section">
+  <xsl:param name="direction"/>
+  <xsl:param name="left"/>
+  <xsl:param name="right"/>
+  <xsl:text>
+div.body { white-space: pre; font-family: monospace; }
+<!-- navbar from mal2html, possibly move to html.xsl -->
+div.navbar {
+  margin: 0 0 1em 0;
+  text-align: right;
+  font-family: sans-serif;
+}
+a.navbar-prev::before {
+  content: '</xsl:text><xsl:choose>
+  <xsl:when test="$left = 'left'"><xsl:text>&#x25C0;&#x00A0;&#x00A0;</xsl:text></xsl:when>
+  <xsl:otherwise><xsl:text>&#x25B6;&#x00A0;&#x00A0;</xsl:text></xsl:otherwise>
+  </xsl:choose><xsl:text>';
+  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
+}
+a.navbar-next::after {
+  content: '</xsl:text><xsl:choose>
+  <xsl:when test="$left = 'left'"><xsl:text>&#x00A0;&#x00A0;&#x25B6;</xsl:text></xsl:when>
+  <xsl:otherwise><xsl:text>&#x00A0;&#x00A0;&#x25C0;</xsl:text></xsl:otherwise>
+  </xsl:choose><xsl:text>';
+  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
+}
+</xsl:text>
+</xsl:template>
+
+<xsl:template mode="html.header.mode" match="Section">
+  <xsl:if test="@up">
+    <div class="trails">
+      <div class="trail">
+        <xsl:call-template name="linktrails"/>
+      </div>
+    </div>
+  </xsl:if>
+</xsl:template>
+
+<xsl:template mode="html.body.mode" match="Section">
+  <div class="navbar">
+    <xsl:variable name="preceding" select="(parent::Section[1] | preceding::Section[1])[last()]"/>
+    <xsl:variable name="following" select="(Section[1] | following::Section[1])[1]"/>
+    <xsl:if test="$preceding">
+      <a class="navbar-prev" href="xref:{$preceding/@id}">
+        <xsl:value-of select="$preceding/@name"/>
+      </a>
+    </xsl:if>
+    <xsl:if test="$preceding and $following">
+      <xsl:text>&#x00A0;&#x00A0;|&#x00A0;&#x00A0;</xsl:text>
+    </xsl:if>
+    <xsl:if test="$following">
+      <a class="navbar-next" href="xref:{$following/@id}">
+        <xsl:value-of select="$following/@name"/>
+      </a>
+    </xsl:if>
+  </div>
+  <xsl:apply-templates select="node()[not(self::Section)]"/>
+</xsl:template>
+
+
+<!-- = Normal Matches = -->
+
 <xsl:template match="para">
   <xsl:value-of select="node()"/>
   <xsl:text>
@@ -120,48 +147,4 @@
   <xsl:apply-templates select="node()[not(self::noteholder)]"/>
 </xsl:template>
 
-<xsl:template name="html.css">
-  <xsl:param name="direction">
-    <xsl:call-template name="l10n.direction"/>
-  </xsl:param>
-  <xsl:param name="left">
-    <xsl:call-template name="l10n.align.start">
-      <xsl:with-param name="direction" select="$direction"/>
-    </xsl:call-template>
-  </xsl:param>
-  <xsl:param name="right">
-    <xsl:call-template name="l10n.align.end">
-      <xsl:with-param name="direction" select="$direction"/>
-    </xsl:call-template>
-  </xsl:param>
-  <xsl:call-template name="theme.html.css">
-    <xsl:with-param name="direction" select="$direction"/>
-    <xsl:with-param name="left" select="$left"/>
-    <xsl:with-param name="right" select="$right"/>
-  </xsl:call-template>
-  <xsl:text>
-div.body { white-space: pre; font-family: monospace; }
-<!-- navbar from mal2html, possibly move to theme-html -->
-div.navbar {
-  margin: 0;
-  float: right;
-  font-family: sans-serif;
-}
-a.navbar-prev::before {
-  content: '</xsl:text><xsl:choose>
-  <xsl:when test="$left = 'left'"><xsl:text>&#x25C0;&#x00A0;&#x00A0;</xsl:text></xsl:when>
-  <xsl:otherwise><xsl:text>&#x25B6;&#x00A0;&#x00A0;</xsl:text></xsl:otherwise>
-  </xsl:choose><xsl:text>';
-  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
-}
-a.navbar-next::after {
-  content: '</xsl:text><xsl:choose>
-  <xsl:when test="$left = 'left'"><xsl:text>&#x00A0;&#x00A0;&#x25B6;</xsl:text></xsl:when>
-  <xsl:otherwise><xsl:text>&#x00A0;&#x00A0;&#x25C0;</xsl:text></xsl:otherwise>
-  </xsl:choose><xsl:text>';
-  color: </xsl:text><xsl:value-of select="$theme.color.text_light"/><xsl:text>;
-}
-</xsl:text>
-</xsl:template>
-
 </xsl:stylesheet>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]