From: Alexey Neyman <stilor@att.net>
Date: Thu, 29 May 2014 21:04:33 +0000 (+0000)
Subject: Only count regular <emphasis> elements (without @role="bold", etc) when determining
X-Git-Tag: release/1.79.1~6^2~54
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8e4c3c7452e48fc541cb6391cf693a0f25b730ef;p=docbook-dsssl

Only count regular <emphasis> elements (without @role="bold", etc) when determining
whether nested emphasis needs to be displayed in italics or in regular; otherwise,
the order of nesting in <emphasis role="bold"> and <emphasis> affects the font
used.
---

diff --git a/xsl/fo/inline.xsl b/xsl/fo/inline.xsl
index 3b426b41b..3539d8a4a 100644
--- a/xsl/fo/inline.xsl
+++ b/xsl/fo/inline.xsl
@@ -711,14 +711,6 @@
 </xsl:template>
 
 <xsl:template match="emphasis">
-  <xsl:variable name="depth">
-    <xsl:call-template name="dot.count">
-      <xsl:with-param name="string">
-        <xsl:number level="multiple"/>
-      </xsl:with-param>
-    </xsl:call-template>
-  </xsl:variable>
-
   <xsl:choose>
     <xsl:when test="@role='bold' or @role='strong'">
       <xsl:call-template name="inline.boldseq"/>
@@ -734,6 +726,11 @@
       </fo:inline>
     </xsl:when>
     <xsl:otherwise>
+      <!-- How many regular emphasis ancestors does this element have -->
+      <xsl:variable name="depth" select="count(ancestor::emphasis
+	[not(contains(' bold strong underline strikethrough ', concat(' ', @role, ' ')))]
+	)"/>
+
       <xsl:choose>
         <xsl:when test="$depth mod 2 = 1">
           <fo:inline font-style="normal">