Hi,
This can be accomplished using a customization similar to the html/onechunk.xsl variant, which is described here:

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

onechunk.xsl employs the chunking mechanism, but creates a single chunk. The customization just makes everything in onechunk.xsl conditional on the name of the root element. So you are not switching between chunking and non-chunking, just how big the chunks are. Here is the customization, which you can tweak as needed:

<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
               version="1.0">

<xsl:import href="../docbook-xsl-1.76.1/html/chunk.xsl"/>

<xsl:param name="base.dir">htmlout/</xsl:param>

<xsl:param name="use.id.as.filename" select="1"/>

<xsl:param name="onechunk">
 <xsl:choose>
   <xsl:when test="local-name(/*[1]) = 'book'">0</xsl:when>
   <xsl:otherwise>1</xsl:otherwise>
 </xsl:choose>
</xsl:param>

<xsl:param name="root.filename">
 <xsl:choose>
   <xsl:when test="$onechunk != 0"></xsl:when>
   <xsl:otherwise>index</xsl:otherwise>
 </xsl:choose>
</xsl:param>

<xsl:param name="suppress.navigation">
 <xsl:choose>
   <xsl:when test="$onechunk != 0">1</xsl:when>
   <xsl:otherwise>0</xsl:otherwise>
 </xsl:choose>
</xsl:param>

<xsl:template name="href.target.uri">
 <xsl:param name="object" select="."/>

 <xsl:choose>
   <xsl:when test="$onechunk != 0">
     <xsl:text>#</xsl:text>
     <xsl:call-template name="object.id">
       <xsl:with-param name="object" select="$object"/>
     </xsl:call-template>
   </xsl:when>
   <xsl:otherwise>
     <xsl:variable name="ischunk">
       <xsl:call-template name="chunk">
         <xsl:with-param name="node" select="$object"/>
       </xsl:call-template>
     </xsl:variable>

     <xsl:apply-templates mode="chunk-filename" select="$object"/>

     <xsl:if test="$ischunk='0'">
       <xsl:text>#</xsl:text>
       <xsl:call-template name="object.id">
         <xsl:with-param name="object" select="$object"/>
       </xsl:call-template>
     </xsl:if>
   </xsl:otherwise>
 </xsl:choose>
</xsl:template>

</xsl:stylesheet>

Bob Stayton
Sagehill Enterprises
[email protected]


----- Original Message ----- From: "Nathalie Sequeira" <[email protected]>
To: <[email protected]>
Sent: Wednesday, December 15, 2010 2:17 AM
Subject: [docbook-apps] choice of xsl modes in customization layer


Hello,

I have a docBook base that contains books and articles that are to be presented as HTML.

Seeing that there are docBook <article> and <book>, it would be desirable to make use of both, and to use chunking for the books (e.g. Table of contents, and single chapters each on another page), while articles do better displayed unchunked.

In the customization layer, I would think I'd have to build something like

if the dB starts with <article> --> use (i.e. import!) html/docbook.xsl
if the dB starts with <book> -->  use docbook-chunk

But I can't do that, since imports need to be top level, right?
So, is there a provision in docbook to get this done?

Thank you!
Nathalie

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to