]> granicus.if.org Git - docbook-dsssl/commitdiff
Improved support for personname inlines.
authorSteve Ball <balls@users.sourceforge.net>
Sun, 17 Aug 2008 22:39:58 +0000 (22:39 +0000)
committerSteve Ball <balls@users.sourceforge.net>
Sun, 17 Aug 2008 22:39:58 +0000 (22:39 +0000)
xsl/roundtrip/blocks2dbk.xsl
xsl/roundtrip/normalise2sections.xsl
xsl/roundtrip/sections2blocks.xsl

index b8b1fa85ee4e3e8b75b527929388ad248338b975..ae86e472fb09b1134917b2d29ef65baf295bb20b 100644 (file)
@@ -31,7 +31,7 @@
   <xsl:param name="nest.sections">1</xsl:param>
 
   <xsl:strip-space elements='*'/>
-  <xsl:preserve-space elements='dbk:para'/>
+  <xsl:preserve-space elements='dbk:para dbk:emphasis'/>
 
   <xsl:template match="&components; |
                        &blocks;">
   </xsl:template>
   <xsl:template match='*|text()' mode='rnd:emphasis'/>
 
+  <xsl:template match='dbk:emphasis' mode='rnd:personname-emphasis'>
+    <xsl:param name='style'/>
+
+    <xsl:choose>
+      <xsl:when test='@rnd:style = $style'>
+        <xsl:apply-templates/>
+        <xsl:apply-templates select='following-sibling::dbk:emphasis[1]'
+          mode='rnd:personname-emphasis'>
+          <xsl:with-param name='style' select='$style'/>
+        </xsl:apply-templates>
+      </xsl:when>
+    </xsl:choose>
+  </xsl:template>
+  <xsl:template match='*|text()' mode='rnd:emphasis'/>
+
   <xsl:template match='dbk:subscript|dbk:superscript'>
     <xsl:copy>
       <xsl:apply-templates select='@*' mode='rnd:copy'/>
 
   <xsl:template match='dbk:footnote' mode='rnd:personname'/>
   <xsl:template match='dbk:emphasis' mode='rnd:personname'>
+    <!-- Need to check preceding emphasis for same style,
+         but blocks pretty-prints and all text nodes
+         are preserved in paragraph content.
+      -->
+    <xsl:variable name='previous'
+      select='preceding-sibling::node()[not(self::text()) or (self::text() and normalize-space() != "")]'/>
+
     <xsl:choose>
+      <!-- inlines are coalesced -->
+      <xsl:when test='@rnd:style = $previous[1][self::dbk:emphasis]/@rnd:style'/>
       <xsl:when test='@rnd:style = "honorific" or
                       @rnd:style = "firstname" or
                       @rnd:style = "lineage" or
         <xsl:element name='{@rnd:style}'
           namespace='http://docbook.org/ns/docbook'>
           <xsl:apply-templates/>
+          <xsl:apply-templates select='following-sibling::dbk:emphasis[1]'
+            mode='rnd:personname-emphasis'>
+            <xsl:with-param name='style' select='@rnd:style'/>
+          </xsl:apply-templates>
         </xsl:element>
       </xsl:when>
       <xsl:otherwise>
index 2838731131c88fbda2e484de74f6361ac593bddf..3855a8c4856ecde371caf22f3ffdfe2fdbc1b59c 100644 (file)
@@ -15,7 +15,7 @@
 <!--====================================-->
   <axsl:output indent="yes"/>
   <axsl:strip-space elements="*"/>
-  <axsl:preserve-space elements="dbk:para"/>
+  <axsl:preserve-space elements="dbk:para dbk:emphasis"/>
   <axsl:template match="dbk:article">
     <axsl:copy>
       <axsl:for-each select="@*">
index a0755692fec7aad57cfb8299526f4f1bc90ce1fc..7d9455a711c53ecea10cab5a2ad483f17cb679d8 100644 (file)
@@ -19,7 +19,7 @@
 <!--====================================-->
   <axsl:output indent="yes"/>
   <axsl:strip-space elements="*"/>
-  <axsl:preserve-space elements="dbk:para"/>
+  <axsl:preserve-space elements="dbk:para dbk:emphasis"/>
   <axsl:template match="dbk:appendix |&#10;  dbk:article |&#10;  dbk:book |&#10;  dbk:chapter |&#10;  dbk:part |&#10;  dbk:preface |&#10;  dbk:section |&#10;  dbk:sect1 |&#10;  dbk:sect2 |&#10;  dbk:sect3 |&#10;  dbk:sect4 |&#10;  dbk:sect5">
     <axsl:variable name="subsections" select="dbk:para[@rnd:style = &quot;bibliography&quot; or @rnd:style = &quot;bibliography-title&quot; or @rnd:style = &quot;glossary&quot; or @rnd:style = &quot;glossary-title&quot; or @rnd:style = &quot;qandaset&quot; or @rnd:style = &quot;qandaset-title&quot;]"/>
     <axsl:copy>