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-apps] Changing chapter title to include chapter id

Wow! Great customizations. It took a lot more magic than I thought.
Thanks a lot, Bob.

On 5/10/05, Bob Stayton <bobs@sagehill.net> wrote:
> ..so I presume you mean you need 2 and 3.

Yes, excuse my poor English. 

> You can achieve the second item by putting the %n back into the gentext
> template, and changing the template that generates the number.  The number
> is generated by apply-templates in mode="label.markup".   

This xsl:apply-imports trick is nice, I hadn't met this element
before. It'll be useful.

A nice collateral effect of using the chapter @id for numbering is
that the use case with id "P100" the figures are indexed as "P100.1",

How would I have discovered -- by myself -- the '<xsl:template
match="chapter" mode="label.markup">'? Do you follow any strategy to
discover it, or I must be a xslt guru to know it? :-)

> For the third item, you can make the localization changes conditional in the
> local.l10n.xml parameter. You can do that by using a parameter in the
> document() function, and making the parameter value conditional.  Here is a
> complete example:

This i10n stuff is still like magic for me. I'll have to study it a little. 

I liked the technique to customise the document based in its content.
It allows me to enforce a style for each kind of document, and the
writer doesn't need to configure anything.

I'm posting below my final customization. I did two little
modifications: 1) used a normalize-space function in the xpath that
discover the kind of document, and 2) created a variable that
specifies the kind of document. It's better to have the definition in
just one place.

Two strings are in Portuguese:
"Relatório de Casos de Uso" -> Use Case Report
"Caso de Uso" -> Use Case

<!--use case customizations -->

<xsl:variable  name="document.class.usecasereport" 
                    'Relatório de Casos de Uso']"/>

<xsl:param name="local.gentext.source">
   <xsl:when test="$document.class.usecasereport">
     <xsl:value-of select="''"/>
     <xsl:copy-of select="."/>

<xsl:param name="local.l10n.xml" select="document($local.gentext.source)"/>

<l:i18n xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0";>
 <l:l10n language="pt_br">
   <l:context name="title-numbered">
     <l:template name="chapter"
                 text="Caso de Uso %n: &#8220;%t&#8221;" />
   <l:context name="xref-number-and-title">
     <l:template name="chapter"
                 text="Caso de Uso %n: &#8220;%t&#8221;" />

<xsl:template match="chapter" mode="label.markup">
   <xsl:when test="$document.class.usecasereport">
     <xsl:value-of select="@id"/>

Thanks again for the help.
Paulo Eduardo Neves
Agenda do Samba & Choro

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