Next in thread → Next in month →

RE: [docbook] Gentext page pg number formatting

From
David White <>
Date
2005-09-20T17:08:56+00:00
ID
20050920121052.SM02280@davidwpc
Thread
RE: [docbook] Gentext page pg number formatting
Hi Bob! Thanks
for the reply,

 

Here is an
example of one of my “override” xml language files:

 

<?xml
version="1.0" encoding="US-ASCII"?>

<l:l10n
xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0"
language="en"
english-language-name="English">

 <l:gentext key="warning" text="WARNING"/>

 <l:gentext key="caution" text="CAUTION"/>

 <l:gentext key="danger" text="DANGER"/>

 <l:gentext key="note" text="Note"/>

 <l:gentext key="TableofContents" text="TABLE
OF CONTENTS"/>

 <l:gentext key="tableofcontents" text="Table
of Contents"/>

 <l:gentext key="pageof" text="
of "/>

 <l:gentext key="continued" text="Continued"/>

 <l:gentext key="TocPage" text="Page"/>

 <l:gentext key="blank.page.notice" text="This
Page Intentionally Left Blank"/>

  <l:gentext key="IMPORTANT" text="IMPORTANT"/>

  <l:gentext key="important" text="Important"/>

  <l:gentext key="Important" text="Important"/>

  

 <l:context name="title">

   <l:template name="figure" text="Figure&#160;%n"/>

 </l:context>

 <l:context name="xref">

   <l:template name="figure" text="Figure&#160;%n"/>

 </l:context>

</l:l10n>

 

From: Bob Stayton [mailto:] 

Sent: Tuesday, September 20, 2005
11:25 AM

To: David White;


Subject: Re: [docbook] Gentext
page pg number formatting

 

This looks like it should work, and in fact it does
work why I try it.  You didn't include a sample of your locale
files.  Do they contain a gentext template for the key 'pageof'?

 

Bob Stayton

Sagehill Enterprises

DocBook Consulting



 

 

----- Original Message ----- 

From: David White 

To: 

Sent: Monday, September
19, 2005 9:29 AM

Subject: [docbook] Gentext
page pg number formatting

 

Hello all,

 

I have a bit of code which is intended
to produce “ 1 of XX “ page numbering for out footer. 
However, it must use gentext to allow for languages which we translate our book
into.

 

Here is how I pull in the language
files:

 

The start of the XSL file…

<?xml
version="1.0" encoding="UTF-8"?>

<!DOCTYPE xsl:stylesheet
[

               
<!ENTITY da.locale SYSTEM "da_OR.xml">

               
<!ENTITY de.locale SYSTEM "de_OR.xml">

               
<!ENTITY el.locale SYSTEM "el_OR.xml">

               
<!ENTITY en.locale SYSTEM "en_OR.xml">

               
<!ENTITY es.locale SYSTEM "es_OR.xml">

               
<!ENTITY fi.locale SYSTEM "fi_OR.xml">

               
<!ENTITY fr.locale SYSTEM "fr_OR.xml">

               
<!ENTITY it.locale SYSTEM "it_OR.xml">

               
<!ENTITY nl.locale SYSTEM "nl_OR.xml">

               
<!ENTITY no.locale SYSTEM "no_OR.xml">

               
<!ENTITY pt.locale SYSTEM "pt_OR.xml">

               
<!ENTITY sv.locale SYSTEM "sv_OR.xml">

               
<!ENTITY ru.locale SYSTEM "ru_OR.xml">

               
<!ENTITY cs.locale SYSTEM "cs_OR.xml">

               
<!ENTITY sk.locale SYSTEM "sk_OR.xml">

               
<!ENTITY sl.locale SYSTEM "sl_OR.xml">

               
<!ENTITY hu.locale SYSTEM "hu_OR.xml">

               
<!ENTITY pl.locale SYSTEM "pl_OR.xml">

               
<!ENTITY hr.locale SYSTEM "hr_OR.xml">

]>

 

These are small XML files which contain key
words for gentext to use over the standard docbook XSL library of translated
words…

 

This is how Gentext is setup:

 

<!--==============================================================-->

<!-- 
Gentext                                                    
-->

<!--==============================================================-->

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

               
<l:i18n
xmlns:l="http://docbook.sourceforge.net/xmlns/l10n/1.0">&da.locale;&de.locale;&el.locale;&en.locale;&es.locale;&fi.locale;&fr.locale;&it.locale;&nl.locale;&no.locale;&pt.locale;&sv.locale;

               
</l:i18n>

 

Then, the template im executing:

 

<xsl:template name="footer.content">

               
<xsl:param name="pageclass"
select="''"/>

               
<xsl:param name="sequence"
select="''"/>

               
<xsl:param name="position"
select="''"/>

               
<xsl:param name="gentext-key"
select="''"/>

               
<xsl:param name="lang"><xsl:call-template name="l10n.language"/></xsl:param>

                                               

 <fo:block>

   <!--
pageclass can be front, body, back -->

   <!--
sequence can be odd, even, first, blank -->

   <!--
position can be left, center, right -->

   <xsl:choose> 

               
<!-- nop; no footer on title
pages -->

    <xsl:when test="$pageclass
= 'titlepage'">  

     </xsl:when>

 

     <xsl:when test="$double.sided
!= 0 and 

                    
(($sequence = 'even'

                    
and $position='left') 

                    
or

                    
(($sequence = 'odd' or $sequence = 'first')

                    
and $position='right'))">

      
<fo:external-graphic>

        
<xsl:attribute name="src">

          
<xsl:call-template name="fo-external-image">

            
<xsl:with-param name="filename">

              
<xsl:call-template name="lang.icon"/>

            
</xsl:with-param>

          
</xsl:call-template>

        
</xsl:attribute>

        
<xsl:attribute name="width">0.45in</xsl:attribute>

      
</fo:external-graphic>

     </xsl:when>

 

     <xsl:when test="$double.sided
!= 0 and 

                    
(($sequence = 'even'

                    
and $position='right') 

                    
or

                    
(($sequence = 'odd' or $sequence = 'first')

                    
and $position='left'))">

      
<xsl:attribute name="font-size">6pt</xsl:attribute>

      
<xsl:value-of
select="$footer.tag"/>

     </xsl:when>

 

     <xsl:when test="$double.sided
!= 0 and $position='center'">

                               
<fo:inline>

                               
<fo:page-number/><xsl:call-template name="gentext.space"/>

                                               
<xsl:call-template name="gentext">

                                                               
<xsl:with-param name="key"
select="'pageof'"/>

                                               
</xsl:call-template>                 

                               
<xsl:call-template name="gentext.space"/><fo:page-number-citation
ref-id="lAsT-pAgE"/> 

                               
</fo:inline>

     

     </xsl:when>

     <xsl:otherwise>

      
<!-- nop -->

     </xsl:otherwise>

   </xsl:choose>

 </fo:block>

</xsl:template>

 

The only output I can manage is:
“1  22”, it simply ignores the gentext call.  I can
replace the gentext with “<xsl:text>of</xsl:text>” and
that does render.

 

Anyone recognize the source of my error?
Next in thread → Next in month →