]> granicus.if.org Git - docbook-dsssl/commitdiff
Added phrase.propagates.style and emphasis.propagates.style: if true, wrap a span...
authorNorman Walsh <ndw@nwalsh.com>
Mon, 16 Jul 2001 21:27:43 +0000 (21:27 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Mon, 16 Jul 2001 21:27:43 +0000 (21:27 +0000)
xsl/html/inline.xsl
xsl/html/param.xsl

index 82e147e7190d034ee489365e64d3f037cc51992c..5d15b01a2495b29e68bd5020630c3e7ca792bbf3 100644 (file)
 </xsl:template>
 
 <xsl:template match="emphasis">
-  <xsl:choose>
-    <xsl:when test="@role='bold'">
-      <xsl:call-template name="inline.boldseq"/>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:call-template name="inline.italicseq"/>
-    </xsl:otherwise>
-  </xsl:choose>
+  <span>
+    <xsl:choose>
+      <xsl:when test="@role and $emphasis.propagates.style != 0">
+        <xsl:attribute name="class">
+          <xsl:value-of select="@role"/>
+        </xsl:attribute>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:attribute name="class">
+          <xsl:text>emphasis</xsl:text>
+        </xsl:attribute>
+      </xsl:otherwise>
+    </xsl:choose>
+    <xsl:if test="@id">
+      <a name="{@id}"/>
+    </xsl:if>
+
+    <xsl:choose>
+      <xsl:when test="@role = 'bold'">
+        <!-- backwards compatibility: make bold into b elements, but -->
+        <!-- don't put bold 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:apply-templates/>
+          </xsl:when>
+          <xsl:otherwise>
+            <b><xsl:apply-templates/></b>
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:when>
+      <xsl:otherwise>
+        <i><xsl:apply-templates/></i>
+      </xsl:otherwise>
+    </xsl:choose>
+  </span>
 </xsl:template>
 
 <xsl:template match="foreignphrase">
 </xsl:template>
 
 <xsl:template match="phrase">
-  <xsl:call-template name="inline.charseq"/>
+  <span>
+    <xsl:if test="@role and $phrase.propagates.style != 0">
+      <xsl:attribute name="class">
+        <xsl:value-of select="@role"/>
+      </xsl:attribute>
+    </xsl:if>
+    <xsl:if test="@id">
+      <a name="{@id}"/>
+    </xsl:if>
+    <xsl:apply-templates/>
+  </span>
 </xsl:template>
 
 <xsl:template match="quote">
index 9346d6e2c850463189f63ff20fba4d4d72c6bde1..12627c3ef687eac12c9817dde4257ab7056f5849 100644 (file)
@@ -1164,4 +1164,28 @@ TOC entries will be displayed.
 </refdescription>
 </doc:param>
 
+<!-- ==================================================================== -->
+<xsl:param name="emphasis.propagates.style" select="1" doc:type='boolean'/>
+
+<doc:param name="emphasis.propagates.style" xmlns="">
+<refpurpose>Pass emphasis role attribute through to HTML?</refpurpose>
+<refdescription>
+<para>If true, the role attribute of <sgmltag>emphasis</sgmltag> elements
+will be passed through to the HTML as a class attribute on a
+<sgmltag>span</sgmltag> that surrounds the emphasis.</para>
+</refdescription>
+</doc:param>
+
+<!-- ==================================================================== -->
+<xsl:param name="phrase.propagates.style" select="1" doc:type='boolean'/>
+
+<doc:param name="phrase.propagates.style" xmlns="">
+<refpurpose>Pass phrase role attribute through to HTML?</refpurpose>
+<refdescription>
+<para>If true, the role attribute of <sgmltag>phrase</sgmltag> elements
+will be passed through to the HTML as a class attribute on a
+<sgmltag>span</sgmltag> that surrounds the phrase.</para>
+</refdescription>
+</doc:param>
+
 </xsl:stylesheet>