]> granicus.if.org Git - docbook-dsssl/commitdiff
Now applies normalize-space to title if it does not have element
authorbobstayton <bobs@sagehill.net>
Tue, 12 Jun 2018 21:07:04 +0000 (14:07 -0700)
committerbobstayton <bobs@sagehill.net>
Wed, 27 Jun 2018 18:10:26 +0000 (11:10 -0700)
children, and warns if there is trailing space that would appear
before the punctuation in the run-in heading.

xsl/fo/block.xsl

index 1c8401c1a48a25adbab378ef7f0da528d682fdc8..5e364ca43b94e22f9bce7f80ecc1336dd97cadb2 100644 (file)
 
 <xsl:template match="d:formalpara/d:title|d:formalpara/d:info/d:title">
   <xsl:variable name="titleStr">
-      <xsl:apply-templates/>
+    <xsl:choose>
+      <!-- cannot safely normalize space if it has child elements -->
+      <xsl:when test="child::*">
+        <xsl:apply-templates/>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="normalize-space(.)"/>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:variable>
+
   <xsl:variable name="lastChar">
     <xsl:if test="$titleStr != ''">
       <xsl:value-of select="substring($titleStr,string-length($titleStr),1)"/>
     </xsl:if>
   </xsl:variable>
 
+  <xsl:if test="contains(' &#10;&#13;', $lastChar)">
+    <xsl:message>
+      <xsl:text>WARNING: formalpara title '</xsl:text>
+      <xsl:value-of select="$titleStr"/>
+      <xsl:text>' has trailing whitespace before runheadhead.title.end.punct.</xsl:text>
+    </xsl:message>
+  </xsl:if>
+
   <fo:inline font-weight="bold"
              keep-with-next.within-line="always"
              padding-end="1em">