OK, it is indeed a bug in the stylesheet. Your test case was for a figure inside an appendix inside an article inside a book. The template for generating the label didn't handle that case properly. This template in a customization layer should fix your problem. I'll check in this fix when I get a chance.

   <xsl:template match="d:figure|d:table|d:example" mode="label.markup">
       <xsl:variable name="pchap"
           select="(ancestor::d:chapter
           |ancestor::d:appendix
           |ancestor::d:article[ancestor::d:book])[last()]"/>

       <xsl:variable name="prefix">
           <xsl:if test="count($pchap) &gt; 0">
               <xsl:apply-templates select="$pchap" mode="label.markup"/>
           </xsl:if>
       </xsl:variable>

       <xsl:choose>
           <xsl:when test="@label">
               <xsl:value-of select="@label"/>
           </xsl:when>
           <xsl:otherwise>
               <xsl:choose>
                   <xsl:when test="$prefix != ''">
<xsl:apply-templates select="$pchap" mode="label.markup"/> <xsl:apply-templates select="$pchap" mode="intralabel.punctuation"/> <xsl:number format="1" from="d:chapter|d:appendix" level="any"/>
                   </xsl:when>
                   <xsl:otherwise>
<xsl:number format="1" from="d:book|d:article" level="any"/>
                   </xsl:otherwise>
               </xsl:choose>
           </xsl:otherwise>
       </xsl:choose>
   </xsl:template>

The difference is just the select attribute for "pchap". Before, it was selecting both the appendix and article nodes, when it should only be selecting a single node, the closest ancestor. The parens and predicate fixes that.

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "Juri Memmert" <[email protected]>
To: "Bob Stayton" <[email protected]>
Cc: <[email protected]>
Sent: Saturday, February 21, 2009 10:55 AM
Subject: Re: [docbook-apps] Title incorrect for figures in appendix


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

Hi Bob,

I re-ran my test and recreated the error.
Attached, you'll find my test case that shows what's going on.

I should have attached it in the first place, sorry for that.


With kinds regards,

Juri Memmert


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEAREDAAYFAkmgTi8ACgkQeKE9NrxdrXwgMACfRwTfkgguSoKwmHMHDaCYFyRP
rT4An3raDOMi/nlU398HOu6ZJN0w8N9D
=ZnpQ
-----END PGP SIGNATURE-----



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to