]> granicus.if.org Git - docbook-dsssl/commitdiff
Add support for writing.mode to set text direction and alignment
authorBob Stayton <bobs@sagehill.net>
Mon, 15 Dec 2008 22:21:16 +0000 (22:21 +0000)
committerBob Stayton <bobs@sagehill.net>
Mon, 15 Dec 2008 22:21:16 +0000 (22:21 +0000)
based on document locale.

xsl/html/docbook.xsl
xsl/html/html.xsl
xsl/html/param.ent
xsl/html/param.xweb

index d5f54865796f35e38b0c39b1eebbfd6a87f92ca1..55ab47d7cc8180a025eea0db88706cfeaba5229a 100644 (file)
   <xsl:attribute name="link">#0000FF</xsl:attribute>
   <xsl:attribute name="vlink">#840084</xsl:attribute>
   <xsl:attribute name="alink">#0000FF</xsl:attribute>
+  <xsl:if test="starts-with($writing.mode, 'rl')">
+    <xsl:attribute name="dir">rtl</xsl:attribute>
+  </xsl:if>
 </xsl:template>
 
 <xsl:template name="head.content">
index 132edac41a3fdafbf70917ac3ccdc4f6e0eb2ab6..441b2ab0832075e50d66183b8d47082dcac36061 100644 (file)
 
      ******************************************************************** -->
 
+<!-- These variables set the alignment value for HTML output based on
+     the writing-mode specified in the gentext file for the document's lang. -->
+
+<xsl:variable name="direction.align.start">
+  <xsl:choose>
+    <xsl:when test="starts-with($writing.mode, 'lr')">left</xsl:when>
+    <xsl:when test="starts-with($writing.mode, 'rl')">right</xsl:when>
+    <xsl:otherwise>left</xsl:otherwise>
+  </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="direction.align.end">
+  <xsl:choose>
+    <xsl:when test="starts-with($writing.mode, 'lr')">right</xsl:when>
+    <xsl:when test="starts-with($writing.mode, 'rl')">left</xsl:when>
+    <xsl:otherwise>right</xsl:otherwise>
+  </xsl:choose>
+</xsl:variable>
+
+<xsl:variable name="direction.mode">
+  <xsl:choose>
+    <xsl:when test="starts-with($writing.mode, 'lr')">ltr</xsl:when>
+    <xsl:when test="starts-with($writing.mode, 'rl')">rtl</xsl:when>
+    <xsl:otherwise>ltr</xsl:otherwise>
+  </xsl:choose>
+</xsl:variable>
+
 <!-- The generate.html.title template is currently used for generating HTML -->
 <!-- "title" attributes for some inline elements only, but not for any -->
 <!-- block elements. It is called in eleven places in the inline.xsl -->
index 49c4125ff6ef3058ff9015349f894f79b5c7e172..8aece97cbb08cb11246960177f92654ff28ae0be 100644 (file)
 <!ENTITY reference.autolabel SYSTEM "../params/reference.autolabel.xml">
 <!ENTITY glossary.sort SYSTEM "../params/glossary.sort.xml">
 <!ENTITY javahelp.encoding SYSTEM "../params/javahelp.encoding.xml">
+<!ENTITY writing.mode SYSTEM "../params/writing.mode.xml">
index 315d9cc7acef3fffa4f104ded8e68acf2e00f24b..1035a8844998b11fa416c4909703fbd197df149d 100644 (file)
@@ -132,6 +132,7 @@ $Id$
 &draft.watermark.image;
 &generate.id.attributes;
 &generate.meta.abstract;
+&writing.mode;
 </reference>
 <reference xml:id="xslt"><title>XSLT Processing</title>
 &rootid;
@@ -726,6 +727,7 @@ around all these parameters.</para>
 <src:fragref linkend="variablelist.as.table.frag"/>
 <src:fragref linkend="variablelist.term.separator.frag"/>
 <src:fragref linkend="variablelist.term.break.after.frag"/>
+<src:fragref linkend="writing.mode.frag"/>
 <src:fragref linkend="xref.with.number.and.title.frag"/>
 <src:fragref linkend="xref.label-title.separator.frag"/>
 <src:fragref linkend="xref.label-page.separator.frag"/>