← Prev in month ← Prev in thread

toc for glossary

From
Cenno Volf
Date
2011-05-12T14:30:53+00:00
ID
Thread
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
← Prev in month ← Prev in thread