Next in thread → Next in month →

Re: [docbook-apps] Chunking dedication element for epub

From
Bob Stayton <>
Date
2011-11-14T17:12:14+00:00
ID
002801cca2f0$88c71160$6600a8c0@pazu
Thread
Re: [docbook-apps] Chunking dedication element for epub
Hi,

I think you are running into the problem of too 
many import levels when customizing chunked HTML output.  Chunking relies 
on xsl:import to separate the actions of chunking from the actions of formatting 
each chunk element.  Because the epub/docbook.xsl stylesheet is already a 
customization layer, importing it and changing things adds another level of 
import precedence that can mess things up.  This section in my book 
describes the contraints on customizing chunked HTML:

 

http://www.sagehill.net/docbookxsl/ChunkingCustomization.html

 

The easiest way to avoid adding another level of 
import precedence to the epub stylesheet is to replace it, not import it.  
That is, copy epub/docbook.xsl as your customization layer and add your 
templates there.  Because epub/docbook.xsl imports or includes the 
xhtml-1_1 stylesheet files, you'll probably need to adjust those paths to make 
it work unless you put your customization file in with the distribution files. 
If you are customizing both chunking behavior and formats, you may need to 
further divide your customization into two parts as described in my 
book.

 

The epub3 stylesheet under development will 
separate the templates into modules to make it easier to customize.

 

Bob Stayton
Sagehill Enterprises


 

 

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

  
From: 
  Xmplar 

  
To:  
  

  
Sent: Monday, November 14, 2011 3:25 
  AM

  
Subject: [docbook-apps] Chunking 
  dedication element for epub

  

  
  
  
  X-NONE
  X-NONE
  
   
   
   
   
   
   
   
   
   
   
   
  
  MicrosoftInternetExplorer4
  
   
   
   
   
   
   
   
   
   
   
   
  

  

  
I have a report with dedication elements used 
  for acknowledgments and executive summary. Currently, the acknowledgments and 
  executive summary appear in the index.html chunk (following the titlepage 
  recto and verso content). I want to create a separate chunk for each of the 
  acknowledgments and executive summary, and have added to a customised 
  stylesheet the templates <xsl:template name="chunk"> (to 
  define dedication as a chunk), the template <xsl:template match="*" mode="recursive-chunk-filename" 
  priority="1"> (to 
  define a filename prefix for dedication) and the template match: 

  
  <xsl:template match="d:set|
    d:book|
    d:part|
    d:dedication|
    d:preface|
    d:chapter|
    d:appendix|
    d:article|
    d:reference|
    d:refentry|
    
  d:book/d:glossary|
    
  d:article/d:glossary|
    
  d:part/d:glossary|
    
  d:bibliography|
    d:colophon"
    priority="1">       
  

    
  <xsl:choose>
      <xsl:when test="$onechunk != 0 
  and parent::*">
        
  <xsl:apply-imports/>
      </xsl:when>
      <xsl:otherwise>
        
  <xsl:call-template name="process-chunk-element"/>
      </xsl:otherwise>
    </xsl:choose>
  </xsl:template> 
  

  
While the customisation creates chunks for both 
  acknowledgments and executive summary, this last template has the effect 
  of:

  
<!--[if !supportLists]-->1.       
  <!--[endif]-->Not including titles for both new 
  chunks (although the content is there)

  
<!--[if !supportLists]-->2.       
  <!--[endif]-->Not generating any tocs and lots 
  chunks (I have set the book toc with separate lots for figures, tables, 
  etc)

  
<!--[if !supportLists]-->3.       
  <!--[endif]-->Removing all content from 
  index.html.

  
? and I haven?t even looked at what?s happening with the 
  OPF and NCX files yet.

  
I?ve tried to trace the chunking template logic starting 
  with the template match coding above to see where I need to add the dedication 
  element to the relevant coding ? I?ve added it to <xsl:template name="chunk-first-section-with-parent" 
  priority="1"> and <xsl:template name="chunk-all-sections" 
  priority="1"> . 

  
I hope there is a straightforward solution, otherwise can 
  someone help to debug my customisations ? my other option is to try manual 
  chunking using the maketoc.xsl procedure in TCG. I?m using 1.76.1-ns. 

  
Thanks,

  
-- 
Dave 
Gardiner
Next in thread → Next in month →