Hi,
I'm not quite clear on how your custom "chaptitle.title" template is being
called. I'm guessing that you have customized the titlepage spec file as
described in my book:
http://www.sagehill.net/docbookxsl/TitleFontSizes.html#ChapterTitles
If so, then the $node variable in the template contains the chapter element,
and you can use $node/@icon to get at the attribute value. The reason
@icon didn't work is because the context node for the template is the
chapter's title element, not the chapter. How do I know that? If you look
in titlepage.templates.xsl, you will find now the original "component.title"
template was called for a chapter:
<xsl:template match="title" mode="chapter.titlepage.recto.auto.mode">
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format"
xsl:use-attribute-sets="chapter.titlepage.recto.style" font-size="24.8832pt"
font-weight="bold">
<xsl:call-template name="component.title">
<xsl:with-param name="node" select="ancestor-or-self::chapter[1]"/>
</xsl:call-template>
</fo:block>
</xsl:template>
This template matches on title, which makes the title the context node for
the call to "component.title".
I think if you had used parent::chapter/@icon in your customization it
would have worked as well.
Bob Stayton
Sagehill Enterprises
[EMAIL PROTECTED]
----- Original Message -----
From: Nancy Brandt
To: [email protected]
Sent: Monday, October 06, 2008 6:32 AM
Subject: [docbook-apps] Adding an icon before a chapter title -continuation
Hi everybody,
what I am actually trying to do is the following:
<!-- Setting chapter title to separate number and label -->
<xsl:template name="chaptitle.title">
<xsl:param name="node" select="."/>
<xsl:variable name="id">
<xsl:call-template name="object.id">
<xsl:with-param name="object" select="$node"/>
</xsl:call-template>
</xsl:variable>
<fo:block xsl:use-attribute-sets="chap.label.properties">
<xsl:apply-templates select="$node" mode="label.markup"/>
</fo:block>
<fo:block xsl:use-attribute-sets="chap.title.properties">
<fo:list-block provisional-distance-between-starts="1cm + 8pt"
provisional-label-separation="8pt">
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>
<fo:external-graphic>
<xsl:attribute name="src">
<xsl:call-template name="fo-external-image">
<xsl:with-param name="filename" select=concat('images', @icon,
'.png'/>
</xsl:call-template>
</xsl:attribute>
</fo:external-graphic>
</fo:block>
</fo:list-item-label>
<fo:list-item-body start-indent="body-start()">
<fo:block>
<xsl:apply-templates select="$node" mode="title.markup"/>
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
</fo:block>
</xsl:template>
An then in the xml file itself I set:
<chapter icon="advanced">
<title>Advanced Settings</title>
....
where "advanced" is the name of the PNG file in the 'images' folder. The
question is how I can pass the variable icon value (in this case "advanced")
to my chapter template.
Thanks in advance!
Nancy
I would like to dynamically add an icon before a chapter title, with a
possibility to change the icon file's name in the XML file itself, and not
in the stylesheet. I would like to add the icon's filename in the chapter's
tag itself (e.g. <chapter icon="internetconn"> and to pass this filename to
the template that will add it to the rest of the file path (eg,
concatenate('/images', @icon, '.png')
Please advise, how to extract the value of the "icon" variable and pass it
to the "concatenate" part of the <fo-external graphic> template?
Thanks a lot!
Nancy
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]