OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Nested emphasis


A coworker reported an issue in FO output with a nested emphasis:

- <emphasis role="bold"><emphasis>foo</emphasis></emphasis> displays "foo" in 
regular bold.

- <emphasis><emphasis role="bold">foo</emphasis></emphasis> displays "foo" in 
bold italics.

This happens because the template in inline.xsl counts the total number of 
ancestor emphasis elements when it does not have a @role - notwithstanding the 
@role attribute on those ancestor.

On a related note, is there a reason why this (and some other templates are 
counting dots in the number generated for the current emphasis, rather than 
doing a simple count(ancestor::emphasis)?

Or in other words, any objections to committing the attached patch?


Index: fo/inline.xsl
--- fo/inline.xsl	(revision 684)
+++ fo/inline.xsl	(working copy)
@@ -687,14 +687,6 @@
 <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:when test="@role='bold' or @role='strong'">
       <xsl:call-template name="inline.boldseq"/>
@@ -710,6 +702,11 @@
+      <!-- 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:when test="$depth mod 2 = 1">
           <fo:inline font-style="normal">

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]