Re: Re: [docbook-apps] Columns in index of article, with docbook-xsl-ns

From
Bob Stayton <>
Date
2008-04-17T23:09:19+00:00
ID
54B2D2AD8EA04C9196A700065D350502@sheeta
Thread
Re: Re: [docbook-apps] Columns in index of article, with docbook-xsl-ns
Oh, right, the page numbering starts over because 
the context node is article when the page.sequence template is called by 
name.  Instead, that template can be called using appy-templates 
in a mode:

 

  <xsl:apply-templates select="index" 
mode="page.sequence">
    <xsl:with-param 
name="content">
      <xsl:apply-templates 
select="index"/>
    </xsl:with-param>
  
</xsl:apply-templates>

(use d:index if you are using the namespaced 
stylesheets).

That sets the context node to be the index element, 
so now the page-sequence is handled as an index, and the page numbering does not 
restart.

 

The headers and footers aren't entirely 
empty.  The page number appears in the footer, as you noted.  Also, 
the "Index" title will appear in the header starting on the second page of the 
index page sequence. The default in DocBook is no header on the first page 
of a page-sequence.   If you want something else, a bit of 
customizing of the header.content template will make it do what you 
want.

 

Regarding a parameter for index column count, that 
actually already exists as the column.count.index parameter:

 

http://docbook.sourceforge.net/release/xsl/current/doc/fo/column.count.index.html

 

But it only applies when an index has its own 
page-sequence using the index page-master, not when an index is handled inside 
the article's body page-sequence.  I think what you want is a parameter to 
set an article index in its own page-sequence so the other parameter can 
apply.

 

Regarding modifying fo/component.xsl, that 
generally is not a good practice, as you found when you updated.  Rather, 
create a customization layer that imports the stock DocBook stylesheet, and add 
any customized templates there to override the stock templates.  Then you 
don't lose your customizations when you update.  
 See:

 

http://www.sagehill.net/docbookxsl/CustomMethods.html#CustomizationLayer

 

Hope this helps.

 

Bob Stayton
Sagehill Enterprises


 

 

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

  
From: 
  Diane Larin 

  
To:  
  

  
Cc: Diane Larin 

  
Sent: Thursday, April 17, 2008 2:31 
  PM

  
Subject: Re: Re: [docbook-apps] Columns 
  in index of article, with docbook-xsl-ns

  

Hi,

I had the same problem as Rasmus and up to now I was 
  using another suggestion Bob gave me on November 1, 2006 (Subject: generating 
  an index with 2 columns) which also consisted of a modification of the 
  fo/component.xsl plus the setting of the column.count.body stylesheet 
  parameter to 2. This was doing the job but with some inconvenience: 

  
    
the header contained the title of the last section instead of Index 
    
more important, twice I updated the stylesheets and I forgot to re-apply 
    the modification to fo/component.xsl and I ended with a complete document in 
    2 columns :-(

Therefore, I was very interested with the new 
  proposed solution. I tried it and found the following problems:

  
    
The numbering of the Index pages restarts at 1 (shown also as page 1 in 
    the Table of Contents)

    
The header and footer of the Index pages are empty 

Whenever 
  it is possible I use book but, for some of my documents, switching to a book 
  is not really a solution because they contain several sections that cannot be 
  organized into chapters and section is not a child of book.

Ideally, it 
  would be possible to use a parameter to specify the number of columns in the 
  Index pages.

Diane

Bob Stayton wrote: 
  <div class="moz-text-flowed" style="font-family: 
    -moz-fixed">Hi, 
Multiple columns are specified in the page-master, so 
    your index content must be removed from the main article page-sequence that 
    uses the "body" page-master and put into a new page-sequence using the 
    "index" page-master. You would have to customize the template with 
    match="article" from fo/component.xsl. 

Near the end of the template, 
    change: 
     ... 
     
    <xsl:apply-templates/> 
   </fo:flow> 
    
 </fo:page-sequence> 

to: 
     
    ... 
     <xsl:apply-templates 
    select="*[not(self::index)]"/> 
   </fo:flow> 
    
 </fo:page-sequence> 
 <xsl:call-template 
    name="page.sequence"> 
   <xsl:with-param 
    name="master-reference">index</xsl:with-param> 
   
    <xsl:with-param name="content"> 
     
    <xsl:apply-templates select="index"/> 
   
    </xsl:with-param> 
 </xsl:call-template> 

Bob 
    Stayton 
Sagehill Enterprises 
 

----- 
    Original Message ----- From: "Rasmus Kaj" <> 
To: <> 
    
Sent: Wednesday, April 16, 2008 10:53 AM 
Subject: [docbook-apps] 
    Columns in index of article, with docbook-xsl-ns 

    Hi! 

I'm trying, without success, to get a 
      multi-column index in a DocBook 
article. 

After a lot of 
      searching I found that the index page-master isn't used 
for an 
      article.  If I switch to a book it works, but then I get loads of 
      
extra page breaks and empty pages that I don't want (and what I write 
      
feels more like an article than a book). 

I do have the index 
      on a page for itself.  Can I specify a page-master 
from my 
      titlepages specification?  Or can I specify a number of column 
in 
      some way that don't require the use of a page-master? 

I'm 
      using DocBook 5.0, docbook-xsl-ns-1.73.2, and fop 0.94. 
      

-- 
Rasmus Kaj <> 
      

--------------------------------------------------------------------- 
      
To unsubscribe, e-mail:  
      
For additional commands, e-mail:  
      

</div>