OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: Re: [docbook] Add the book name to the title

Thanks Bob!

For those people interested, here is the code I used to get the name
of the document and prepend it to the <title> information:

<xsl:variable name="my.title.parameter">
 <xsl:call-template name="get.doc.title"/>

<xsl:template name="head.content">
 <xsl:param name="node" select="."/>
 <xsl:param name="title">
   <xsl:value-of select="$my.title.parameter"/>
   <xsl:text>: </xsl:text>
   <xsl:apply-templates select="$node" mode="object.title.markup.textonly"/>
More information is located at:


> On Thu, Nov 12, 2009 at 10:44 AM, Bob Stayton <bobs@sagehill.net> wrote:
>> [moving this over to the docbook-apps mailing list where stylesheet issues
>> are discussed.]
>> Hi Jon,
>> As you discovered, variable references in gentext are not processed.  There
>> is a template named 'substitute.markup' in common/gentext.xsl that handles
>> replacing the % placeholders with generated text.  You would need to
>> customize that template to resolve variable references.
>> I would caution about adding the book title in the 'title-numbered' context,
>> as that gentext may be used in other places besides the HTML head title.
>> Instead, I would focus on the template where that HTML title element is
>> generated.  That template is named 'head.content' and it is in
>> html/docbook.xsl.  You could customize that template to add the book title.
>> A variable reference could be used there.
>> Bob Stayton
>> Sagehill Enterprises
>> bobs@sagehill.net
>> ----- Original Message ----- From: "Jon W" <knowdat@gmail.com>
>> To: <docbook@lists.oasis-open.org>
>> Sent: Wednesday, November 11, 2009 9:28 AM
>> Subject: [docbook] Add the book name to the title
>>> Hi.  Currently in the <title> section of our html, we list the number
>>> %n and title %t.  We would like to pre-pend the name of the book to
>>> the <title> information, so the google search results contain the name
>>> of the book in the link.
>>> For example, if the name of the book is "My Book", the search would
>>> look similar to:
>>>  My Book: 4.6.1 Jack and Jill go home
>>> I know about using local.l10n.xml to process generated text, but
>>> haven't found a way to use a variable in the <l:template> section.  I
>>> would like to set the local.l10n.xml settings in a common xsl file
>>> that each of the 10 books can use the same xsl.
>>> Is there a way for a variable called $mybookname to be used in the
>>> local.l10n.xml settings?  The following code does not expand the
>>> variable $mybookname:
>>> <xsl:param name="local.l10n.xml" select="document('')"/>
>>> <l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0";>
>>>  <l:l10n language="en">
>>>   <l:context name="title-numbered">
>>>     <l:template name="sect1" text="$mybookname %n. %t"/>
>>>   </l:context>
>>>  </l:l10n>
>>> </l:i18n>
>>> Here is the example of our current html, for which I would like to add
>>> the book name:
>>> <html>
>>>  <head>
>>>     <meta http-equiv="Content-Type" content="text/html;
>>> charset=ISO-8859-1">
>>>     <title>4.6.1. Jack and Jill go home</title>
>>> Thank you,
>>> Jon
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: docbook-unsubscribe@lists.oasis-open.org
>>> For additional commands, e-mail: docbook-help@lists.oasis-open.org

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]