This is the mail archive of the
docbook-apps@lists.oasis-open.org
mailing list .
[docbook-apps] XSL custom chunk with navigation. e.g. legalnotice
- From: TiP <TiP at tut dot by>
- To: docbook-apps at lists dot oasis-open dot org
- Date: Wed, 29 Sep 2004 14:56:25 +0200
- Subject: [docbook-apps] XSL custom chunk with navigation. e.g. legalnotice
- Reply-to: TiP <TiP at tut dot by>
Hello docbook-apps,
I need to chunk legalnotice with navigation headers with the
following template.
---
<xsl:template match="legalnotice" mode="titlepage.mode">
<xsl:variable name="id"><xsl:call-template name="object.id"/></xsl:variable>
<xsl:variable name="filename">
<xsl:call-template name="make-relative-filename">
<xsl:with-param name="base.dir" select="$base.dir"/>
<xsl:with-param name="base.name" select="concat($id,$html.ext)"/>
</xsl:call-template>
</xsl:variable>
<xsl:variable name="title">
<xsl:apply-templates select="." mode="title.markup"/>
</xsl:variable>
<xsl:call-template name="write.chunk">
<xsl:with-param name="filename" select="$filename"/>
<xsl:with-param name="quiet" select="$chunk.quietly"/>
<xsl:with-param name="content">
<xsl:call-template name="chunk-element-content">
<xsl:with-param name="prev" select="/foo"/>
<xsl:with-param name="next" select="/foo"/>
<xsl:with-param name="content">
<xsl:apply-templates mode="titlepage.mode"/>
</xsl:with-param>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
---
But compiler generates a warning:
---
No template for "/book/bookinfo" (or any of its leaves) exists
in the context named "title" in the "en" localization.
No template for "/book/bookinfo" (or any of its leaves) exists
in the context named "title" in the "en" localization.
---
The problem is from my point of view, that parent of <legalnotice>
is <bookinfo> which is not a chunk and doesn't have <title> attribute
to process in "header.navigation" and "html.head" templates from
chunk-common.xsl by the
<xsl:apply-templates select="$up" mode="object.title.markup"/>
instruction.
Though I could define such template solely for /book/bookinfo, this
will not fix the problem with "UP" link in generated legalnotice
point to the same chunk as "HOME". So, to make it correct I need to
reproduce a whole "footer.navigation" template with a small addition
<xsl:variable name="row1" select="count($prev) > 0
or (count($up) > 0 and local-name($up) != 'bookinfo')
or count($next) > 0"/>
I'd like to make my solution more universal and I can see it like make
$up variable contain not parent, but correct first chunk element along
ancestor axis. The problem is that I can't see a way to do this. Current
$up value in 1.66.1 XSL is
<xsl:variable name="up" select="parent::*"/>
I wonder also if it will be possible to include such customization in
XSL distribution? (if there is any, of course)
--
TiP