Hi,
In DocBook XSL, the term 'label' usually refers to a number, like chapter 
number or table number. Those are generally included in an entry in a table of 
contents. The template named 'toc.line' in fo/autotoc.xsl that is used to 
generate each entry has this:

  <xsl:variable name="label">
    <xsl:apply-templates select="." mode="label.markup"/>
  </xsl:variable>

Apparently the elements glossdiv and glossentry do not have a template with 
mode="label.markup".  So the processor falls back to the template with 
match="*" and mode="label.markup" in common/labels.xsl, which generates that 
error message.

As you found, that isn't a problem because if the $label variable is empty, it 
is not used.  You could add your own empty template to avoid the noise:

   <xsl:template match="d:glossdiv | d:glossentry" mode="label.markup"/>

This empty template will prevent the default template from being used.

Bob Stayton
Sagehill Enterprises
[email protected]


  ----- Original Message ----- 
  From: Benno Wolf 
  To: [email protected] 
  Sent: Thursday, May 12, 2011 7:30 AM
  Subject: [docbook-apps] toc for glossary


  Hi,
  I have a couple of standalone Glossaries for my docus to be printed out as 
kind of a lexicon. So I wanted a nice table of content made out of glossdivs 
and glossentries. I therefor took a template and changed it to what I thought 
was the right way to get what I wanted; here's the customized template:


        <!-- writes a table of contents for the glossary -->
        <xsl:template match="d:glossary|d:glossdiv|d:glossentry|d:glossterm" 
mode="toc">
            <xsl:param name="toc-context" select="."/>
            <xsl:variable name="id">
                <xsl:call-template name="object.id"/>
            </xsl:variable>
            <xsl:variable name="cid">
                <xsl:call-template name="object.id">
                    <xsl:with-param name="object" select="$toc-context"/>
                </xsl:call-template>
            </xsl:variable>
            <xsl:call-template name="toc.line">
                <xsl:with-param name="toc-context" select="$toc-context"/>
            </xsl:call-template>

            <xsl:variable name="nodes" 
select="d:glossary|d:glossdiv|d:glossentry"/>

            <xsl:variable name="depth.from.context"
                select="count(ancestor::*)-count($toc-context/ancestor::*)"/>

            <xsl:if
                test="$toc.section.depth > 0 
                and $toc.max.depth > $depth.from.context
                and $nodes">
                <fo:block id="toc.{$cid}.{$id}">
                    <xsl:attribute name="margin-{$direction.align.start}">
                        <xsl:call-template name="set.toc.indent"/>
                    </xsl:attribute>

                    <xsl:apply-templates select="$nodes" mode="toc">
                        <xsl:with-param name="toc-context" 
select="$toc-context"/>
                    </xsl:apply-templates>
                </fo:block>
            </xsl:if>
        </xsl:template>


  This works fine, the glossary toc looks like it should: 




  But I get a lot of errors during generation, saying labels for glossdiv and 
glossentries are missing:


    Request for label of unexpected element: glossdiv
    Request for label of unexpected element: glossentry


  Probably a daft question, but where are the labels being called in the 
template?
  As I said, the outcome is not affected by these messages, but the data 
generation process looks a bit messy - and it can't be right.
  Any comment is appreciated!

  Thanks,
  Benno

Reply via email to