[yelp-xsl] db2html: Use html.lang.attrs everywhere



commit cd14dbd22a45857cdfdfd10b6dedbf3f6bfbf684
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Nov 11 13:38:56 2011 -0500

    db2html: Use html.lang.attrs everywhere

 xslt/docbook/html/db2html-division.xsl |   24 ++------------
 xslt/docbook/html/db2html-inline.xsl   |   26 ++--------------
 xslt/docbook/html/db2html-refentry.xsl |    2 +-
 xslt/docbook/html/db2html-table.xsl    |   51 ++++---------------------------
 xslt/docbook/html/db2html-title.xsl    |   21 ++----------
 5 files changed, 19 insertions(+), 105 deletions(-)
---
diff --git a/xslt/docbook/html/db2html-division.xsl b/xslt/docbook/html/db2html-division.xsl
index 0391a0c..6431cda 100644
--- a/xslt/docbook/html/db2html-division.xsl
+++ b/xslt/docbook/html/db2html-division.xsl
@@ -97,8 +97,6 @@ $divisions: The division-level child elements
 $depth_in_chunk: The depth of ${node} in the containing chunk
 $depth_of_chunk: The depth of the containing chunk in the document
 $chunk_divisions: Whether to create new documents for ${divisions}
-$lang: The locale of the text in ${node}
-$dir: The text direction, either #{ltr} or #{rtl}
 
 REMARK: Talk about some of the parameters
 -->
@@ -121,10 +119,10 @@ REMARK: Talk about some of the parameters
   <xsl:param name="chunk_divisions"
              select="($depth_in_chunk = 0) and
                      ($depth_of_chunk &lt; $db.chunk.max_depth)"/>
-  <xsl:param name="lang" select="$node/@lang | $node/@xml:lang"/>
-  <xsl:param name="dir" select="false()"/>
-
   <div>
+    <xsl:call-template name="html.lang.attrs">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
     <xsl:attribute name="class">
       <xsl:value-of select="local-name($node)"/>
       <xsl:choose>
@@ -136,20 +134,6 @@ REMARK: Talk about some of the parameters
         </xsl:otherwise>
       </xsl:choose>
     </xsl:attribute>
-    <xsl:choose>
-      <xsl:when test="$dir = 'ltr' or $dir = 'rtl'">
-        <xsl:attribute name="dir">
-          <xsl:value-of select="$dir"/>
-        </xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$lang">
-        <xsl:attribute name="dir">
-          <xsl:call-template name="l10n.direction">
-            <xsl:with-param name="lang" select="$lang"/>
-          </xsl:call-template>
-        </xsl:attribute>
-      </xsl:when>
-    </xsl:choose>
     <xsl:if test="$node/@id">
       <xsl:attribute name="id">
         <xsl:value-of select="$node/@id"/>
@@ -224,7 +208,7 @@ REMARK: Talk about how this works with #{callback}
     <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
   </xsl:apply-templates>
   <xsl:if test="$entries">
-    <div class="block">
+    <div>
       <dl class="{local-name($node)}">
         <xsl:apply-templates select="$entries">
           <xsl:with-param name="depth_in_chunk" select="$depth_in_chunk + 1"/>
diff --git a/xslt/docbook/html/db2html-inline.xsl b/xslt/docbook/html/db2html-inline.xsl
index 5840686..e621999 100644
--- a/xslt/docbook/html/db2html-inline.xsl
+++ b/xslt/docbook/html/db2html-inline.xsl
@@ -62,8 +62,6 @@ $node: The element to render
 $children: The child elements to process
 $class: The value of the #{class} attribute on the #{span} tag
 $lang: The locale of the text in ${node}
-$dir: The text direction, either #{ltr} or #{rtl}
-$ltr: Whether to default to #{ltr} if neither ${lang} nor ${dir} is specified
 $name-class: The class to use for the name of the element
 
 REMARK: Document this template
@@ -73,33 +71,15 @@ REMARK: Document this template
   <xsl:param name="children" select="false()"/>
   <xsl:param name="class" select="''"/>
   <xsl:param name="lang" select="$node/@lang|$node/@xml:lang"/>
-  <xsl:param name="dir" select="false()"/>
-  <xsl:param name="ltr" select="false()"/>
   <xsl:param name="name-class" select="local-name($node)"/>
   <xsl:variable name="xlink" select="$node/@xl:href"/>
   <xsl:variable name="linkend" select="$node/@linkend"/>
 
   <!-- FIXME: do CSS classes, rather than inline styles -->
   <span class="{$class} {$name-class}">
-    <xsl:choose>
-      <xsl:when test="$dir = 'ltr' or $dir = 'rtl'">
-        <xsl:attribute name="dir">
-          <xsl:value-of select="$dir"/>
-        </xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$lang">
-        <xsl:attribute name="dir">
-          <xsl:call-template name="l10n.direction">
-            <xsl:with-param name="lang" select="$lang"/>
-          </xsl:call-template>
-        </xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$ltr">
-        <xsl:attribute name="dir">
-          <xsl:text>ltr</xsl:text>
-        </xsl:attribute>
-      </xsl:when>
-    </xsl:choose>
+    <xsl:call-template name="html.lang.attrs">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
     <xsl:call-template name="db2html.anchor">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
diff --git a/xslt/docbook/html/db2html-refentry.xsl b/xslt/docbook/html/db2html-refentry.xsl
index 68fafda..cb09b2b 100644
--- a/xslt/docbook/html/db2html-refentry.xsl
+++ b/xslt/docbook/html/db2html-refentry.xsl
@@ -94,7 +94,7 @@ REMARK: Describe this module. Talk about refenty and friends
   <xsl:param name="depth_of_chunk">
     <xsl:call-template name="db.chunk.depth-of-chunk"/>
   </xsl:param>
-  <div class="block refnamediv">
+  <div class="refnamediv">
     <xsl:call-template name="db2html.anchor"/>
     <xsl:choose>
       <xsl:when test="refdescriptor">
diff --git a/xslt/docbook/html/db2html-table.xsl b/xslt/docbook/html/db2html-table.xsl
index 83113ec..47610cc 100644
--- a/xslt/docbook/html/db2html-table.xsl
+++ b/xslt/docbook/html/db2html-table.xsl
@@ -421,22 +421,9 @@ element to output the next #{td}.
       </xsl:variable>
       <!-- Finally, output the td or th element -->
       <xsl:element name="{$element}" namespace="{$html.namespace}">
-        <xsl:choose>
-          <xsl:when test="@lang or @xml:lang">
-            <xsl:attribute name="dir">
-              <xsl:call-template name="l10n.direction">
-                <xsl:with-param name="lang" select="@lang | @xml:lang"/>
-              </xsl:call-template>
-            </xsl:attribute>
-          </xsl:when>
-          <xsl:when test="../@lang or ../@xml:lang">
-            <xsl:attribute name="dir">
-              <xsl:call-template name="l10n.direction">
-                <xsl:with-param name="lang" select="../@lang | ../@xml:lang"/>
-              </xsl:call-template>
-            </xsl:attribute>
-          </xsl:when>
-        </xsl:choose>
+        <xsl:call-template name="html.lang.attrs">
+          <xsl:with-param name="parent" select=".."/>
+        </xsl:call-template>
         <xsl:if test="$style != ''">
           <xsl:attribute name="style">
             <xsl:value-of select="normalize-space($style)"/>
@@ -970,13 +957,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
     </xsl:choose>
   </xsl:variable>
   <table>
-    <xsl:if test="@lang or @xml:lang">
-      <xsl:attribute name="dir">
-        <xsl:call-template name="l10n.direction">
-          <xsl:with-param name="lang" select="@lang | @xml:lang"/>
-        </xsl:call-template>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.lang.attrs"/>
     <xsl:apply-templates select="thead | db:thead">
       <xsl:with-param name="colspecs" select="colspec | db:colspec"/>
       <xsl:with-param name="spanspecs" select="spanspec | db:spanspec"/>
@@ -995,13 +976,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
 <!-- = table = -->
 <xsl:template match="table | informaltable | db:table | db:informaltable">
   <div class="table">
-    <xsl:if test="@lang or @xml:lang">
-      <xsl:attribute name="dir">
-        <xsl:call-template name="l10n.direction">
-          <xsl:with-param name="lang" select="@lang | @xml:lang"/>
-        </xsl:call-template>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.lang.attrs"/>
     <xsl:call-template name="db2html.anchor"/>
     <xsl:apply-templates select="title | db:title | db:info/db:title"/>
     <!-- FIXME: I have no idea what I'm supposed to do with textobject -->
@@ -1083,13 +1058,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
     </xsl:if>
   </xsl:variable>
   <table>
-    <xsl:if test="@lang or @xml:lang">
-      <xsl:attribute name="dir">
-        <xsl:call-template name="l10n.direction">
-          <xsl:with-param name="lang" select="@lang | @xml:lang"/>
-        </xsl:call-template>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.lang.attrs"/>
     <xsl:if test="../title or ../db:title or ../db:info/db:title">
       <xsl:attribute name="summary">
         <xsl:value-of select="../title | ../db:title | ../db:info/db:title"/>
@@ -1133,13 +1102,7 @@ REMARK: This template needs to be explained in detail, but I forgot how it works
   <xsl:param name="colsep" select="''"/>
   <xsl:param name="rowsep" select="''"/>
   <xsl:element name="{local-name(.)}" namespace="{$html.namespace}">
-    <xsl:if test="@lang or @xml:lang">
-      <xsl:attribute name="dir">
-        <xsl:call-template name="l10n.direction">
-          <xsl:with-param name="lang" select="@lang | @xml:lang"/>
-        </xsl:call-template>
-      </xsl:attribute>
-    </xsl:if>
+    <xsl:call-template name="html.lang.attrs"/>
     <xsl:if test="@valign">
       <xsl:attribute name="valign">
         <xsl:value-of select="@valign"/>
diff --git a/xslt/docbook/html/db2html-title.xsl b/xslt/docbook/html/db2html-title.xsl
index bbbd290..825b1c5 100644
--- a/xslt/docbook/html/db2html-title.xsl
+++ b/xslt/docbook/html/db2html-title.xsl
@@ -36,7 +36,6 @@ Generates a labeled block title
 $node: The element to generate a title for
 $referent: The element that ${node} is a title for
 $lang: The locale of the text in ${node}
-$dir: The text direction, either #{ltr} or #{rtl}
 
 REMARK: Talk about the different kinds of title blocks
 -->
@@ -44,27 +43,15 @@ REMARK: Talk about the different kinds of title blocks
   <xsl:param name="node" select="."/>
   <xsl:param name="referent" select="$node/.."/>
   <xsl:param name="lang" select="$node/@lang | $node/@xml:lang"/>
-  <xsl:param name="dir" select="false()"/>
   <xsl:variable name="depth_in_chunk">
     <xsl:call-template name="db.chunk.depth-in-chunk">
       <xsl:with-param name="node" select="$referent"/>
     </xsl:call-template>
   </xsl:variable>
-  <div class="block {local-name($node)}">
-    <xsl:choose>
-      <xsl:when test="$dir = 'ltr' or $dir = 'rtl'">
-        <xsl:attribute name="dir">
-          <xsl:value-of select="$dir"/>
-        </xsl:attribute>
-      </xsl:when>
-      <xsl:when test="$lang">
-        <xsl:attribute name="dir">
-          <xsl:call-template name="l10n.direction">
-            <xsl:with-param name="lang" select="$lang"/>
-          </xsl:call-template>
-        </xsl:attribute>
-      </xsl:when>
-    </xsl:choose>
+  <div class="{local-name($node)}">
+    <xsl:call-template name="html.lang.attrs">
+      <xsl:with-param name="node" select="$node"/>
+    </xsl:call-template>
     <span class="{local-name($node)}">
       <xsl:call-template name="db2html.anchor">
         <xsl:with-param name="node" select="$node"/>



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