Bugs and refinements - quandset - preamble - biblioentries - graphic -

Karsten Ohme <[email protected]> Fri, 27 May 2005 17:02:10 +0200
Newsgroups gmane.text.docbook.db2latex.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------020905040707080700050904
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

Toto be able to work, I had to include one patch in the 
qandaset.mod.xsl, which removes a template which is not used and let 
every XSLT processor fail. This patch was already there, but not 
included in the CVS. Why?

Another bug was a missing '' in preamble.mod.xsl in line 523 for saxon 8

-		<xsl:if test="$latex.use.varioref='1'">
+		<xsl:if test="$latex.use.varioref=1">

I added a support for the scale and align="center" attribute of graphic 
of DocBook.

The xref to biblioentries did not generate a label. I used the XrefLabel 
to do this.

Beyonf this xalan cannot compile the stylesheets. Somebody a solution?

Please include this.

Bye, Karsten

--------------020905040707080700050904
Content-Type: text/plain;
 name="db2latex.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="db2latex.diff"

diff -rNbBu db2latex-my/xsl/graphic.mod.xsl db2latex/xsl/graphic.mod.xsl
--- db2latex-my/xsl/graphic.mod.xsl	2005-05-27 16:35:29.190353600 +0200
+++ db2latex/xsl/graphic.mod.xsl	2004-01-02 08:25:45.000000000 +0100
@@ -102,14 +102,6 @@
 		</doc:variables>
 	</doc:template>
 	<xsl:template match="inlinegraphic" name="inlinegraphic">
-		<xsl:if test="@align=center">
-            <xsl:text>\center{</xsl:text>
-        </xsl:if>
-		<xsl:if test="@scale">
-			<xsl:text>\scalebox{0.</xsl:text>
-			<xsl:value-of select="@scale"/>
-            <xsl:text>}{</xsl:text>
-        </xsl:if>
         <xsl:text>\includegraphics{</xsl:text>
         <xsl:choose>
              <xsl:when test="@entityref">
@@ -120,12 +112,6 @@
         	</xsl:otherwise>
         </xsl:choose>
         <xsl:text>}</xsl:text>
-		<xsl:if test="@scale">
-			<xsl:text>}</xsl:text>
-        </xsl:if>
-		<xsl:if test="@align=center">
-            <xsl:text>}</xsl:text>
-        </xsl:if>
 	</xsl:template>
 
 </xsl:stylesheet>
diff -rNbBu db2latex-my/xsl/preamble.mod.xsl db2latex/xsl/preamble.mod.xsl
--- db2latex-my/xsl/preamble.mod.xsl	2005-05-27 14:16:19.944728000 +0200
+++ db2latex/xsl/preamble.mod.xsl	2004-01-31 13:26:12.000000000 +0100
@@ -523,7 +523,7 @@
 		<xsl:text>% ---------------------- &#10;</xsl:text>
 		<xsl:text>% Most Common Packages   &#10;</xsl:text>
 		<xsl:text>% ---------------------- &#10;</xsl:text>
-		<xsl:if test="$latex.use.varioref='1'">
+		<xsl:if test="$latex.use.varioref=1">
 			<xsl:text>\usepackage[</xsl:text>
 			<xsl:value-of select="$latex.varioref.options"/>
 			<xsl:text>]{varioref} &#10;</xsl:text>
diff -rNbBu db2latex-my/xsl/qandaset.mod.xsl db2latex/xsl/qandaset.mod.xsl
--- db2latex-my/xsl/qandaset.mod.xsl	2005-05-27 14:03:02.988761600 +0200
+++ db2latex/xsl/qandaset.mod.xsl	2004-01-04 14:22:27.000000000 +0100
@@ -363,4 +363,53 @@
 	</doc:template>
 	<xsl:template match="revhistory" mode="qandatoc.mode"/>
 
+<xsl:template name="question.answer.label">
+	<!-- variable: deflabel -->
+  <xsl:variable name="deflabel">
+  	<!-- chck whether someone has a defaultlabel attribute -->
+    <xsl:choose>
+		<xsl:when test="ancestor-or-self::*[@defaultlabel]">
+        	<xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]/@defaultlabel"/>
+	      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="latex.qanda.defaultlabel"/>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
+
+  <xsl:variable name="label" select="@label"/>
+  <xsl:choose>
+    <xsl:when test="$deflabel = 'qanda'">
+      <xsl:call-template name="gentext">
+        <xsl:with-param name="key">
+          <xsl:choose>
+            <xsl:when test="local-name(.) = 'question'">question</xsl:when>
+            <xsl:when test="local-name(.) = 'answer'">answer</xsl:when>
+            <xsl:when test="local-name(.) = 'qandadiv'">qandadiv</xsl:when>
+            <xsl:otherwise>qandaset</xsl:otherwise>
+          </xsl:choose>
+        </xsl:with-param>
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:when test="$deflabel = 'label'">
+      <xsl:value-of select="$label"/>
+    </xsl:when>
+    <xsl:when test="$deflabel = 'number' and local-name(.) = 'question'">
+      <xsl:apply-templates select="ancestor::qandaset[1]" mode="number"/>
+      <xsl:choose>
+        <xsl:when test="ancestor::qandadiv">
+          <xsl:apply-templates select="ancestor::qandadiv[1]" mode="number"/>
+          <xsl:apply-templates select="ancestor::qandaentry" mode="number"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:apply-templates select="ancestor::qandaentry" mode="number"/>
+        </xsl:otherwise>
+      </xsl:choose>
+    </xsl:when>
+    <xsl:otherwise>
+      <!-- nothing -->
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
 </xsl:stylesheet>
diff -rNbBu db2latex-my/xsl/xref.mod.xsl db2latex/xsl/xref.mod.xsl
--- db2latex-my/xsl/xref.mod.xsl	2005-05-27 16:26:07.672931200 +0200
+++ db2latex/xsl/xref.mod.xsl	2004-08-12 08:23:33.000000000 +0200
@@ -750,11 +750,7 @@
 <xsl:template match="*" mode="xref-to">
   <xsl:param name="referrer"/>
   <xsl:param name="xrefstyle"/>
-  <xsl:choose>
-    <xsl:when test="@XrefLabel">
-        <xsl:value-of select="@XrefLabel"/>
-    </xsl:when>
-    <xsl:otherwise>
+
           <xsl:message>
             <xsl:text>Don't know what gentext to create for xref to: "</xsl:text>
             <xsl:value-of select="name(.)"/>
@@ -763,8 +759,6 @@
           <xsl:text>?</xsl:text>
           <xsl:value-of select="$referrer/@linkend"/>
           <xsl:text>?</xsl:text>
-    </xsl:otherwise>
-  </xsl:choose>
 </xsl:template>
 
 <xsl:template match="title" mode="xref-to">

--------------020905040707080700050904--


-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005