]> granicus.if.org Git - docbook-dsssl/commitdiff
Support shade.verbatim in FO; stop using vendor test to decide what extension functio...
authorNorman Walsh <ndw@nwalsh.com>
Sat, 20 Apr 2002 15:03:09 +0000 (15:03 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sat, 20 Apr 2002 15:03:09 +0000 (15:03 +0000)
xsl/fo/param.ent
xsl/fo/param.xweb
xsl/fo/verbatim.xsl
xsl/params/shade.verbatim.style.xml

index ac7f23933317ca07d5c017e25bde36a850f7145e..8ac9b16d632f52ddc3fbedf9d6913513ef659772 100644 (file)
 <!ENTITY section.autolabel SYSTEM "../params/section.autolabel.xml">
 <!ENTITY section.label.includes.component.label SYSTEM "../params/section.label.includes.component.label.xml">
 <!ENTITY segmentedlist.as.table SYSTEM "../params/segmentedlist.as.table.xml">
+<!ENTITY shade.verbatim SYSTEM "../params/shade.verbatim.xml">
+<!ENTITY shade.verbatim.style SYSTEM "../params/shade.verbatim.style.xml">
 <!ENTITY show.comments SYSTEM "../params/show.comments.xml">
 <!ENTITY table.border.color SYSTEM "../params/table.border.color.xml">
 <!ENTITY table.border.style SYSTEM "../params/table.border.style.xml">
index 493e1a135afd3865a7b5fdbcb33db21c6136c5c6..feac37e9682cccd03bd75b3270b248b2ec0db091 100644 (file)
@@ -188,6 +188,8 @@ generate.section.toc.level;
 &ulink.show;
 &ulink.footnotes;
 &ulink.hyphenate;
+&shade.verbatim;
+&shade.verbatim.style;
 </reference>
 
 <reference><title>Pagination and General Styles</title>
@@ -479,6 +481,8 @@ around all these parameters.</para>
 <src:fragref linkend="section.autolabel.frag"/>
 <src:fragref linkend="section.label.includes.component.label.frag"/>
 <src:fragref linkend="segmentedlist.as.table.frag"/>
+<src:fragref linkend="shade.verbatim.frag"/>
+<src:fragref linkend="shade.verbatim.style.frag"/>
 <src:fragref linkend="show.comments.frag"/>
 <src:fragref linkend="table.border.color.frag"/>
 <src:fragref linkend="table.border.style.frag"/>
index b7e6c222cb1815cdd011c67479546c0598e0588f..234e527c125372b2c87e736973a62b9489f11b9e 100644 (file)
 
 <xsl:template match="programlisting|screen|synopsis">
   <xsl:param name="suppress-numbers" select="'0'"/>
-  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
   <xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
 
-  <xsl:choose>
-    <xsl:when test="$suppress-numbers = '0'
-                    and @linenumbering = 'numbered'
-                    and $use.extensions != '0'
-                    and $linenumbering.extension != '0'">
-      <xsl:variable name="rtf">
-        <xsl:apply-templates/>
-      </xsl:variable>
-      <fo:block wrap-option='no-wrap'
-                white-space-collapse='false'
-                linefeed-treatment="preserve"
-                xsl:use-attribute-sets="monospace.verbatim.properties">
+  <xsl:variable name="content">
+    <xsl:choose>
+      <xsl:when test="$suppress-numbers = '0'
+                      and @linenumbering = 'numbered'
+                      and $use.extensions != '0'
+                      and $linenumbering.extension != '0'">
         <xsl:call-template name="number.rtf.lines">
-          <xsl:with-param name="rtf" select="$rtf"/>
+          <xsl:with-param name="rtf">
+            <xsl:apply-templates/>
+          </xsl:with-param>
         </xsl:call-template>
-      </fo:block>
-    </xsl:when>
-    <xsl:otherwise>
-      <fo:block wrap-option='no-wrap'
-                white-space-collapse='false'
-                linefeed-treatment="preserve"
-                xsl:use-attribute-sets="monospace.verbatim.properties">
+      </xsl:when>
+      <xsl:otherwise>
         <xsl:apply-templates/>
-      </fo:block>
-    </xsl:otherwise>
-  </xsl:choose>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="monospace.verbatim.properties">
+    <xsl:choose>
+      <xsl:when test="$shade.verbatim != 0">
+        <fo:block space-before="0pt" space-after="0pt"
+                  xsl:use-attribute-sets="shade.verbatim.style">
+          <xsl:copy-of select="$content"/>
+        </fo:block>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$content"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </fo:block>
 </xsl:template>
 
 <xsl:template match="literallayout">
   <xsl:param name="suppress-numbers" select="'0'"/>
-  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
 
-  <xsl:variable name="rtf">
-    <xsl:apply-templates/>
+  <xsl:variable name="raw.content">
+    <xsl:choose>
+      <xsl:when test="$suppress-numbers = '0'
+                      and @linenumbering = 'numbered'
+                      and $use.extensions != '0'
+                      and $linenumbering.extension != '0'">
+        <xsl:call-template name="number.rtf.lines">
+          <xsl:with-param name="rtf">
+            <xsl:apply-templates/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:variable>
 
-  <xsl:choose>
-    <xsl:when test="$suppress-numbers = '0'
-                    and @linenumbering = 'numbered'
-                    and $use.extensions != '0'
-                    and $linenumbering.extension != '0'">
-      <xsl:choose>
-        <xsl:when test="@class='monospaced'">
-          <fo:block wrap-option='no-wrap'
-                    linefeed-treatment="preserve"
-                    white-space-collapse='false'
-                    xsl:use-attribute-sets="monospace.verbatim.properties">
-            <xsl:call-template name="number.rtf.lines">
-              <xsl:with-param name="rtf" select="$rtf"/>
-            </xsl:call-template>
-          </fo:block>
-        </xsl:when>
-        <xsl:otherwise>
-          <fo:block wrap-option='no-wrap'
-                    linefeed-treatment="preserve"
-                    white-space-collapse='false'
-                    xsl:use-attribute-sets="verbatim.properties">
-            <xsl:call-template name="number.rtf.lines">
-              <xsl:with-param name="rtf" select="$rtf"/>
-            </xsl:call-template>
-          </fo:block>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:when>
-    <xsl:otherwise>
-      <xsl:choose>
-        <xsl:when test="@class='monospaced'">
-          <fo:block wrap-option='no-wrap'
-                    linefeed-treatment="preserve"
-                    white-space-collapse='false'
-                    xsl:use-attribute-sets="monospace.verbatim.properties">
-            <xsl:copy-of select="$rtf"/>
-          </fo:block>
-        </xsl:when>
-        <xsl:otherwise>
-          <fo:block wrap-option='no-wrap'
-                    linefeed-treatment="preserve"
-                    white-space-collapse='false'
-                    xsl:use-attribute-sets="verbatim.properties">
-            <xsl:copy-of select="$rtf"/>
-          </fo:block>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:otherwise>
-  </xsl:choose>
-</xsl:template>
-
-<xsl:template match="address">
-  <xsl:param name="suppress-numbers" select="'0'"/>
-  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
-
-  <xsl:variable name="rtf">
-    <xsl:apply-templates/>
+  <xsl:variable name="content">
+    <xsl:choose>
+      <xsl:when test="@class='monospaced' and $shade.verbatim != 0">
+        <fo:block space-before="0pt" space-after="0pt"
+                  xsl:use-attribute-sets="shade.verbatim.style">
+          <xsl:copy-of select="$raw.content"/>
+        </fo:block>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:copy-of select="$raw.content"/>
+      </xsl:otherwise>
+    </xsl:choose>
   </xsl:variable>
 
   <xsl:choose>
-    <xsl:when test="$suppress-numbers = '0'
-                    and @linenumbering = 'numbered'
-                    and $use.extensions != '0'
-                    and $linenumbering.extension != '0'">
+    <xsl:when test="@class='monospaced'">
       <fo:block wrap-option='no-wrap'
-                white-space-collapse='false'
                 linefeed-treatment="preserve"
-                xsl:use-attribute-sets="verbatim.properties">
-        <xsl:call-template name="number.rtf.lines">
-          <xsl:with-param name="rtf" select="$rtf"/>
-        </xsl:call-template>
+                white-space-collapse='false'
+                xsl:use-attribute-sets="monospace.verbatim.properties">
+        <xsl:copy-of select="$content"/>
       </fo:block>
     </xsl:when>
     <xsl:otherwise>
                 linefeed-treatment="preserve"
                 white-space-collapse='false'
                 xsl:use-attribute-sets="verbatim.properties">
-        <xsl:apply-templates/>
+        <xsl:copy-of select="$content"/>
       </fo:block>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
 
+<xsl:template match="address">
+  <xsl:param name="suppress-numbers" select="'0'"/>
+
+  <xsl:variable name="content">
+    <xsl:choose>
+      <xsl:when test="$suppress-numbers = '0'
+                      and @linenumbering = 'numbered'
+                      and $use.extensions != '0'
+                      and $linenumbering.extension != '0'">
+        <xsl:call-template name="number.rtf.lines">
+          <xsl:with-param name="rtf">
+            <xsl:apply-templates/>
+          </xsl:with-param>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:apply-templates/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <fo:block wrap-option='no-wrap'
+            white-space-collapse='false'
+            linefeed-treatment="preserve"
+            xsl:use-attribute-sets="verbatim.properties">
+    <xsl:copy-of select="$content"/>
+  </fo:block>
+</xsl:template>
+
 <xsl:template name="number.rtf.lines">
   <xsl:param name="rtf" select="''"/>
   <xsl:param name="pi.context" select="."/>
     </xsl:choose>
   </xsl:variable>
 
-  <xsl:variable name="vendor" select="system-property('xsl:vendor')"/>
-
   <xsl:choose>
-    <xsl:when test="contains($vendor, 'SAXON ')">
+    <xsl:when test="function-available('sverb:numberLines')">
       <xsl:copy-of select="sverb:numberLines($rtf)"/>
     </xsl:when>
-    <xsl:when test="contains($vendor, 'Apache Software Foundation')">
+    <xsl:when test="function-available('xverb:numberLines')">
       <xsl:copy-of select="xverb:numberLines($rtf)"/>
     </xsl:when>
     <xsl:otherwise>
       <xsl:message terminate="yes">
-        <xsl:text>Don't know how to do line numbering with </xsl:text>
-        <xsl:value-of select="$vendor"/>
+        <xsl:text>No numberLines function available.</xsl:text>
       </xsl:message>
     </xsl:otherwise>
   </xsl:choose>
index 7ed2ccb45b5c206f60f89824d83e31f586f8c676..34805cedad0c7595c34810e6a84f5e51f0cd9629 100644 (file)
@@ -9,10 +9,15 @@
 </refnamediv>
 
 <refsynopsisdiv>
-<src:fragment id='shade.verbatim.style.frag'><xsl:attribute-set name="shade.verbatim.style">
+<src:fragment id='shade.verbatim.style.frag'>
+<xsl:attribute-set condition="html" name="shade.verbatim.style">
   <xsl:attribute name="border">0</xsl:attribute>
   <xsl:attribute name="bgcolor">#E0E0E0</xsl:attribute>
-</xsl:attribute-set></src:fragment>
+</xsl:attribute-set>
+<xsl:attribute-set condition="fo" name="shade.verbatim.style">
+  <xsl:attribute name="background-color">#E0E0E0</xsl:attribute>
+</xsl:attribute-set>
+</src:fragment>
 </refsynopsisdiv>
 
 <refsect1><title>Description</title>