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] | [Elist Home]


Subject: Re: DOCBOOK-APPS: Chunking question


Thank you, this looked promising, but after playing with it (and with 
all other methods suggested) I think it's not quite what I'm looking 
for. It does however give me a nice starting point to try to make my own 
implementation. What I'm trying to do is to put all <sectx> content that 
has no <sectx + 1> children on one page, and pass all <sectx + 1> child 
elements to the chunk template again to have the same applied again. 
Wording it that, I'm going to try to implement it. That is not to say 
that advice would not be welcome ;)


cheers,

roel


Janning Vygen wrote:
> Am Montag, 13. Januar 2003 23:09 schrieb Bob Stayton:
> 
>>On Mon, Jan 13, 2003 at 02:13:24PM -0500, Jeff Beal wrote:
>>
>>>Customizing the chunking to the extent you appear to want is
>>>quite difficult, especially if you want to maintain reasonable
>>>previous/next/up links in the output.  
> 
> [...]
> 
>>There was another message that suggested the use of PIs
>>in the document, but I don't think it was ever implemented.
>>
>>http://lists.oasis-open.org/archives/docbook-apps/200209/msg00007.h
>>tml
> 
> 
> It was implemented.
> 
> The file is attached to this mail. It was quite easy but it is not 
> very well tested because the need for manual chunking via PI didn't 
> arrise in the project it was made for.
>  
> It just overrides the template name="chunk"
> 
> you can use PIs like this to chunk a section. Just put it inside the 
> section as a child of the section element. 
> 
> <?dbhtml chunk-childs="1" chunk-first-sections="0"?>
> 
> I dont know if this file works with the newest docbook-xsl release. 
> and it works only with chunkfast.xsl i think.
> 
> I just hope it gives you a hint how easy it is to implement chunking 
> with PIs. I hope this file can be of any help.
> 
> kind regards 
> janning
> 
> 
> 
> ------------------------------------------------------------------------
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>                 version="1.0">
> 
> <!-- 
>       2002, written by vygen@planwerk6.de, 
>       1) you can decide via Processing Instruction 
>       if you want to chunk the childs of the parent node of the PI
>       2) you can override the value of chunk.first.sections via PI
> 
>      Put PIs like this into your chapter or sections
>     
>      <?dbhtml chunk-childs="1" chunk-first-sections="0"?>
> 
>      chunk-first-sections is inherited by all subsequent childs if not
>      changed again by another PI
> 
>      chunk-childs affects only the childs of the parnet node of the PI
>      (put your PI _into_ a chapter to chunk the sections inside this chapter
>  
>      you can only decide to 
>      - chunk all childs but not the first
>      - chunk all child including the first
>      - chunk no childs 
>      
>      NO WARRENTY, most of the code is copyright by xsl guru norm walsh
> -->
> 
> <xsl:include href="chunkfast.xsl"/>
> 
> <xsl:template name="dbhtml-chunk-childs">
>   <xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
>   <xsl:call-template name="dbhtml-attribute">
>     <xsl:with-param name="pis" select="$pis"/>
>     <xsl:with-param name="attribute">chunk-childs</xsl:with-param>
>   </xsl:call-template>
> </xsl:template>
> 
> <xsl:template name="dbhtml-chunk-first-sections">
>   <xsl:param name="pis" select="./processing-instruction('dbhtml')"/>
>   <xsl:call-template name="dbhtml-attribute">
>     <xsl:with-param name="pis" select="$pis"/>
>     <xsl:with-param name="attribute">chunk-first-sections</xsl:with-param>
>   </xsl:call-template>
> </xsl:template>
> 
> <xsl:template name="chunk">
>   <xsl:param name="node" select="."/>
>   <!-- returns 1 if $node is a chunk -->
> 
>   <xsl:variable name="dbhtml-chunk-childs">
>     <xsl:call-template name="dbhtml-chunk-childs">
>       <xsl:with-param name="pis" select="$node/parent::*/processing-instruction('dbhtml')"/>
>     </xsl:call-template>
>   </xsl:variable>
> 
>   <xsl:variable name="dbhtml-chunk-first-sections">
>     <xsl:call-template name="dbhtml-chunk-first-sections">
>     <xsl:with-param name="pis" select="$node/ancestor::*[contains(./processing-instruction('dbhtml'),'chunk-first-sections=')][1]/processing-instruction('dbhtml')"/>
>     </xsl:call-template>
>   </xsl:variable>
> 
>   <xsl:choose>
>     <xsl:when test="not($node/parent::*)">1</xsl:when>
> 
>     <xsl:when test="local-name($node) = 'sect1'
>                     and (  $dbhtml-chunk-childs = 1 or ($chunk.section.depth &gt;= 1 and $dbhtml-chunk-childs = '') )
>                     and ( ($dbhtml-chunk-first-sections = 1 or ($chunk.first.sections   != 0 and $dbhtml-chunk-first-sections = '') )
>                          or count($node/preceding-sibling::sect1) &gt; 0)">
>       <xsl:text>1</xsl:text>
>     </xsl:when>
>     <xsl:when test="local-name($node) = 'sect2'
>                     and (  $dbhtml-chunk-childs = 1 or ($chunk.section.depth &gt;= 2 and $dbhtml-chunk-childs = '') )
>                     and ( ($dbhtml-chunk-first-sections = 1 or ($chunk.first.sections   != 0 and $dbhtml-chunk-first-sections = '') )
>                          or count($node/preceding-sibling::sect2) &gt; 0)">
>       <xsl:call-template name="chunk">
>         <xsl:with-param name="node" select="$node/parent::*"/>
>       </xsl:call-template>
>     </xsl:when>
>     <xsl:when test="local-name($node) = 'sect3'
>                     and (  $dbhtml-chunk-childs = 1 or ($chunk.section.depth &gt;= 3 and $dbhtml-chunk-childs = '') )
>                     and ( ($dbhtml-chunk-first-sections = 1 or ($chunk.first.sections   != 0 and $dbhtml-chunk-first-sections = '') )
>                          or count($node/preceding-sibling::sect3) &gt; 0)">
>       <xsl:call-template name="chunk">
>         <xsl:with-param name="node" select="$node/parent::*"/>
>       </xsl:call-template>
>     </xsl:when>
>     <xsl:when test="local-name($node) = 'sect4'
>                     and (  $dbhtml-chunk-childs = 1 or ($chunk.section.depth &gt;= 4 and $dbhtml-chunk-childs = '') )
>                     and ( ($dbhtml-chunk-first-sections = 1 or ($chunk.first.sections   != 0 and $dbhtml-chunk-first-sections = '') )
>                          or count($node/preceding-sibling::sect4) &gt; 0)">
>       <xsl:call-template name="chunk">
>         <xsl:with-param name="node" select="$node/parent::*"/>
>       </xsl:call-template>
>     </xsl:when>
>     <xsl:when test="local-name($node) = 'sect5'
>                     and (  $dbhtml-chunk-childs = 1 or ($chunk.section.depth &gt;= 5 and $dbhtml-chunk-childs = '') )
>                     and ( ($dbhtml-chunk-first-sections = 1 or ($chunk.first.sections   != 0 and $dbhtml-chunk-first-sections = '') )
>                          or count($node/preceding-sibling::sect5) &gt; 0)">
>       <xsl:call-template name="chunk">
>         <xsl:with-param name="node" select="$node/parent::*"/>
>       </xsl:call-template>
>     </xsl:when>
>     <xsl:when test="local-name($node) = 'section'
>                     and (  $dbhtml-chunk-childs = 1 or ($chunk.section.depth &gt;= count($node/ancestor::section)+1 and $dbhtml-chunk-childs = '') )
>                     and ( ($dbhtml-chunk-first-sections = 1 or ($chunk.first.sections   != 0 and $dbhtml-chunk-first-sections = '') )
>                          or count($node/preceding-sibling::section) &gt; 0)">
>       <xsl:call-template name="chunk">
>         <xsl:with-param name="node" select="$node/parent::*"/>
>       </xsl:call-template>
>     </xsl:when>
> 
>     <xsl:when test="name($node)='preface'">1</xsl:when>
>     <xsl:when test="name($node)='chapter'">1</xsl:when>
>     <xsl:when test="name($node)='appendix'">1</xsl:when>
>     <xsl:when test="name($node)='article'">1</xsl:when>
>     <xsl:when test="name($node)='part'">1</xsl:when>
>     <xsl:when test="name($node)='reference'">1</xsl:when>
>     <xsl:when test="name($node)='refentry'">1</xsl:when>
>     <xsl:when test="name($node)='index'
>                     and (name($node/parent::*) = 'article'
>                          or name($node/parent::*) = 'book')">1</xsl:when>
>     <xsl:when test="name($node)='bibliography'
>                     and (name($node/parent::*) = 'article'
>                          or name($node/parent::*) = 'book')">1</xsl:when>
>     <xsl:when test="name($node)='glossary'
>                     and (name($node/parent::*) = 'article'
>                          or name($node/parent::*) = 'book')">1</xsl:when>
>     <xsl:when test="name($node)='colophon'">1</xsl:when>
>     <xsl:when test="name($node)='book'">1</xsl:when>
>     <xsl:when test="name($node)='set'">1</xsl:when>
>     <xsl:when test="name($node)='setindex'">1</xsl:when>
>     <xsl:otherwise>0</xsl:otherwise>
>   </xsl:choose>
> </xsl:template>
> 
> </xsl:stylesheet>
> 



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


Powered by eList eXpress LLC