1 ;; Id: patch-db2latex-duplicate-template-bug,v 1.2 2007/01/12 22:24:20 sra Exp
3 ;; This is a patch to work around a known bug in db2latex. Apparently
4 ;; xsltproc's error checking got a lot better since the authors of
5 ;; db2latex last tested this, so a clear language violation that
6 ;; xsltproc used to ignore now prevents xsltproc from working with
9 ;; On FreeBSD you can simply drop this patch into the directory
10 ;; /usr/ports/textproc/db2latex/files/ and the ports system should
11 ;; take it from there. I've sent this patch off to the port
12 ;; maintainer but have not yet heard anything back.
14 ;; I don't really know whther this is the "right" fix, but it seems to
15 ;; work, and I'm pretty sure that the code this patch deletes does not
16 ;; work as it stands, so at worst the result after applying this patch
17 ;; should be no worse than the result without this patch.
19 ;; YMMV. If this patch breaks, you get to keep both pieces.
21 Index: xsl/qandaset.mod.xsl
22 --- xsl/qandaset.mod.xsl.~1~ Sun Jan 4 08:22:27 2004
23 +++ xsl/qandaset.mod.xsl Fri Apr 1 22:30:20 2005
26 <xsl:template match="revhistory" mode="qandatoc.mode"/>
28 -<xsl:template name="question.answer.label">
29 - <!-- variable: deflabel -->
30 - <xsl:variable name="deflabel">
31 - <!-- chck whether someone has a defaultlabel attribute -->
33 - <xsl:when test="ancestor-or-self::*[@defaultlabel]">
34 - <xsl:value-of select="(ancestor-or-self::*[@defaultlabel])[last()]/@defaultlabel"/>
37 - <xsl:value-of select="latex.qanda.defaultlabel"/>
42 - <xsl:variable name="label" select="@label"/>
44 - <xsl:when test="$deflabel = 'qanda'">
45 - <xsl:call-template name="gentext">
46 - <xsl:with-param name="key">
48 - <xsl:when test="local-name(.) = 'question'">question</xsl:when>
49 - <xsl:when test="local-name(.) = 'answer'">answer</xsl:when>
50 - <xsl:when test="local-name(.) = 'qandadiv'">qandadiv</xsl:when>
51 - <xsl:otherwise>qandaset</xsl:otherwise>
54 - </xsl:call-template>
56 - <xsl:when test="$deflabel = 'label'">
57 - <xsl:value-of select="$label"/>
59 - <xsl:when test="$deflabel = 'number' and local-name(.) = 'question'">
60 - <xsl:apply-templates select="ancestor::qandaset[1]" mode="number"/>
62 - <xsl:when test="ancestor::qandadiv">
63 - <xsl:apply-templates select="ancestor::qandadiv[1]" mode="number"/>
64 - <xsl:apply-templates select="ancestor::qandaentry" mode="number"/>
67 - <xsl:apply-templates select="ancestor::qandaentry" mode="number"/>