]> granicus.if.org Git - docbook-dsssl/commitdiff
Rudimentary support for @dir
authorNorman Walsh <ndw@nwalsh.com>
Fri, 29 Aug 2003 14:58:39 +0000 (14:58 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Fri, 29 Aug 2003 14:58:39 +0000 (14:58 +0000)
xsl/fo/inline.xsl
xsl/html/inline.xsl

index 26a0f9e37f34e036a8be39eb440be071d5c987ca..006af5877603cf1f6a4a32089847118ee165c7e9 100644 (file)
   <xsl:param name="content">
     <xsl:apply-templates/>
   </xsl:param>
-  <xsl:copy-of select="$content"/>
+
+  <xsl:choose>
+    <xsl:when test="@dir">
+      <fo:inline>
+        <xsl:attribute name="direction">
+          <xsl:choose>
+            <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+            <xsl:otherwise>rtl</xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+        <xsl:copy-of select="$content"/>
+      </fo:inline>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:copy-of select="$content"/>
+    </xsl:otherwise>
+  </xsl:choose>
 </xsl:template>
 
 <xsl:template name="inline.monoseq">
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline xsl:use-attribute-sets="monospace.properties">
+    <xsl:if test="@dir">
+      <xsl:attribute name="direction">
+        <xsl:choose>
+          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+          <xsl:otherwise>rtl</xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
     <xsl:copy-of select="$content"/>
   </fo:inline>
 </xsl:template>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline font-weight="bold">
+    <xsl:if test="@dir">
+      <xsl:attribute name="direction">
+        <xsl:choose>
+          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+          <xsl:otherwise>rtl</xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
     <xsl:copy-of select="$content"/>
   </fo:inline>
 </xsl:template>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline font-style="italic">
+    <xsl:if test="@dir">
+      <xsl:attribute name="direction">
+        <xsl:choose>
+          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+          <xsl:otherwise>rtl</xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
     <xsl:copy-of select="$content"/>
   </fo:inline>
 </xsl:template>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline font-weight="bold" xsl:use-attribute-sets="monospace.properties">
+    <xsl:if test="@dir">
+      <xsl:attribute name="direction">
+        <xsl:choose>
+          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+          <xsl:otherwise>rtl</xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
     <xsl:copy-of select="$content"/>
   </fo:inline>
 </xsl:template>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline font-style="italic" xsl:use-attribute-sets="monospace.properties">
+    <xsl:if test="@dir">
+      <xsl:attribute name="direction">
+        <xsl:choose>
+          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+          <xsl:otherwise>rtl</xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
     <xsl:copy-of select="$content"/>
   </fo:inline>
 </xsl:template>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline>
+    <xsl:if test="@dir">
+      <xsl:attribute name="direction">
+        <xsl:choose>
+          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+          <xsl:otherwise>rtl</xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
     <xsl:choose>
       <xsl:when test="$fop.extensions != 0">
         <xsl:attribute name="vertical-align">super</xsl:attribute>
     <xsl:apply-templates/>
   </xsl:param>
   <fo:inline>
+    <xsl:if test="@dir">
+      <xsl:attribute name="direction">
+        <xsl:choose>
+          <xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
+          <xsl:otherwise>rtl</xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+    </xsl:if>
     <xsl:choose>
       <xsl:when test="$fop.extensions != 0">
         <xsl:attribute name="vertical-align">sub</xsl:attribute>
index db08b85db91d0c442ee0bc3840071458484427bf..7a4ed280fb4601ac15f1e2f94b5f76e9b0946da9 100644 (file)
       </xsl:with-param>
     </xsl:call-template>
   </xsl:param>
-  <span class="{local-name(.)}"><xsl:copy-of select="$content"/></span>
+  <span class="{local-name(.)}">
+    <xsl:if test="@dir">
+      <xsl:attribute name="dir">
+        <xsl:value-of select="@dir"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:copy-of select="$content"/>
+  </span>
 </xsl:template>
 
 <xsl:template name="inline.monoseq">
       </xsl:with-param>
     </xsl:call-template>
   </xsl:param>
-  <tt class="{local-name(.)}"><xsl:copy-of select="$content"/></tt>
+  <tt class="{local-name(.)}">
+    <xsl:if test="@dir">
+      <xsl:attribute name="dir">
+        <xsl:value-of select="@dir"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:copy-of select="$content"/>
+  </tt>
 </xsl:template>
 
 <xsl:template name="inline.boldseq">
       </xsl:with-param>
     </xsl:call-template>
   </xsl:param>
-  <!-- don't put <b> inside figure, example, or table titles -->
-  <xsl:choose>
-    <xsl:when test="local-name(..) = 'title'
-                    and (local-name(../..) = 'figure'
-                         or local-name(../..) = 'example'
-                         or local-name(../..) = 'table')">
-      <xsl:copy-of select="$content"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <b class="{local-name(.)}"><xsl:copy-of select="$content"/></b>
-    </xsl:otherwise>
-  </xsl:choose>
+
+  <span>
+    <xsl:if test="@dir">
+      <xsl:attribute name="dir">
+        <xsl:value-of select="@dir"/>
+      </xsl:attribute>
+    </xsl:if>
+
+    <!-- don't put <b> inside figure, example, or table titles -->
+    <xsl:choose>
+      <xsl:when test="local-name(..) = 'title'
+                      and (local-name(../..) = 'figure'
+                      or local-name(../..) = 'example'
+                      or local-name(../..) = 'table')">
+        <xsl:copy-of select="$content"/>
+      </xsl:when>
+      <xsl:otherwise>
+        <b class="{local-name(.)}">
+          <xsl:copy-of select="$content"/>
+        </b>
+      </xsl:otherwise>
+    </xsl:choose>
+  </span>
 </xsl:template>
 
 <xsl:template name="inline.italicseq">
       </xsl:with-param>
     </xsl:call-template>
   </xsl:param>
-  <i class="{local-name(.)}"><xsl:copy-of select="$content"/></i>
+  <i class="{local-name(.)}">
+    <xsl:if test="@dir">
+      <xsl:attribute name="dir">
+        <xsl:value-of select="@dir"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:copy-of select="$content"/>
+  </i>
 </xsl:template>
 
 <xsl:template name="inline.boldmonoseq">
                          or local-name(../..) = 'example'
                          or local-name(../..) = 'table'
                          or local-name(../..) = 'formalpara')">
-      <tt class="{local-name(.)}"><xsl:copy-of select="$content"/></tt>
+      <tt class="{local-name(.)}">
+        <xsl:if test="@dir">
+          <xsl:attribute name="dir">
+            <xsl:value-of select="@dir"/>
+          </xsl:attribute>
+        </xsl:if>
+        <xsl:copy-of select="$content"/>
+      </tt>
     </xsl:when>
     <xsl:otherwise>
-      <b class="{local-name(.)}"><tt><xsl:copy-of select="$content"/></tt></b>
+      <b class="{local-name(.)}">
+        <tt>
+          <xsl:if test="@dir">
+            <xsl:attribute name="dir">
+              <xsl:value-of select="@dir"/>
+            </xsl:attribute>
+          </xsl:if>
+          <xsl:copy-of select="$content"/>
+        </tt>
+      </b>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
       </xsl:with-param>
     </xsl:call-template>
   </xsl:param>
-  <i class="{local-name(.)}"><tt><xsl:copy-of select="$content"/></tt></i>
+  <i class="{local-name(.)}">
+    <tt>
+      <xsl:if test="@dir">
+        <xsl:attribute name="dir">
+          <xsl:value-of select="@dir"/>
+        </xsl:attribute>
+      </xsl:if>
+      <xsl:copy-of select="$content"/>
+    </tt>
+  </i>
 </xsl:template>
 
 <xsl:template name="inline.superscriptseq">
       </xsl:with-param>
     </xsl:call-template>
   </xsl:param>
-  <sup><xsl:copy-of select="$content"/></sup>
+  <sup>
+    <xsl:if test="@dir">
+      <xsl:attribute name="dir">
+        <xsl:value-of select="@dir"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:copy-of select="$content"/>
+  </sup>
 </xsl:template>
 
 <xsl:template name="inline.subscriptseq">
       </xsl:with-param>
     </xsl:call-template>
   </xsl:param>
-  <sub><xsl:copy-of select="$content"/></sub>
+  <sub>
+    <xsl:if test="@dir">
+      <xsl:attribute name="dir">
+        <xsl:value-of select="@dir"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:copy-of select="$content"/>
+  </sub>
 </xsl:template>
 
 <!-- ==================================================================== -->