[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] force pagebreaks in a glossary
This will teach me to always test my answers before posting them. 8^) A glossary as list is handled differently from other lists. In the make-glossary template, it explicitly selects only 'glossentry' elements to process. Since it is not a general 'apply-templates', the PI is never selected for processing. Also, it turns out that it is easier to use a separate PI template in 'glossary.as.list' mode. Here is a complete solution that works with FOP: <!-- This selects the PI as well as the glossentry elements for processing --> <xsl:template match="glossary"> <xsl:call-template name="make-glossary"> <xsl:with-param name="entries" select="glossentry|processing-instruction('pagebreak')"/> </xsl:call-template> </xsl:template> <!-- This is your old PI, which is no longer used for glossary entries --> <!-- Page orientation and layout --> <xsl:template match="processing-instruction('pagebreak')"> <fo:block break-after="page"/> </xsl:template> <!-- This handles the PI in the glossary --> <xsl:template match="processing-instruction('pagebreak')" mode="glossary.as.list"> <fo:list-item break-before="page"> <fo:list-item-label><fo:block/></fo:list-item-label> <fo:list-item-body><fo:block/></fo:list-item-body> </fo:list-item> </xsl:template> Bob Stayton Sagehill Enterprises DocBook Consulting bobs@sagehill.net ----- Original Message ----- From: "A.R. (Tom) Peters" <tpeters@xs4all.nl> To: "docbook-apps" <docbook-apps@lists.oasis-open.org> Sent: Sunday, May 08, 2005 6:24 AM Subject: Re: [docbook-apps] force pagebreaks in a glossary > On Sat, 7 May 2005, Bob Stayton wrote: > > > Hi Tom, > > I meant for you to put the code snippet inside the template that handles > > your processing instruction: > > > > <xsl:template match="processing-instruction('pagebreak')"> > > <xsl:choose> > > ... > > </xsl:template> > > > > My print.xsl now has: > > <!-- Page orientation and layout --> > <xsl:template match="processing-instruction('pagebreak')"> > <xsl:choose> > <xsl:when test="parent::glossary and $glossary.as.blocks=0"> > <fo:list-item break-before="page"> > <fo:list-item-label><fo:block/></fo:list-item-label> > <fo:list-item-body><fo:block/></fo:list-item-body> > </fo:list-item> > </xsl:when> > <xsl:otherwise> > <fo:block break-before="page"/> > </xsl:otherwise> > </xsl:choose> > <!-- Used to be: > <fo:block break-after="page"/> > --> > </xsl:template> > > > > Also, you will need to add a namespace declaration to your customization > > stylesheet for the fo: namespace. You can do that at the top of the file as > > described here: > > > > http://www.sagehill.net/docbookxsl/CustomMethods.html#WriteCustomization > > I derived my print.xsl from a template that came with Debian. It has had > this at the head: > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1" > xmlns:fo="http://www.w3.org/1999/XSL/Format" > > > > > > Hopefully this will work now. > > Halas... > > I execute this: > > xsltproc -o GemBook.fo --stringparam paper.type A4 --param > simplesect.in.toc 0 --stringparam glossary.as.blocks 0 print.xsl > GemBook.tmp > > The code in the print.xsl (see above) specifies break-before="page" now > (used to be break-after="page") and this now appears in the .fo for the > normal text, so the <xsl:choose> section is processed; but there are still > no pagebreaks in the glossary section. This surprises me, even if the > condition is not met there should be an explicit <fo:block > break-after="page"/>. Instead I get this in the .fo: > > ... > <fo:list-item space-before.optimum="1em" space-before.minimum="0.8em" > space-before.maximum="1.2em" id="Halfedelsteen"><fo:list-item-label > end-indent="label-end()"><fo:block>Half-edelsteen<fo:wrapper > id="id2541959"><!--Half-edelsteen--></fo:wrapper></fo:block></fo:list-item-l abel> > <fo:list-item-body start-indent="body-start()"><fo:block > space-before.optimum="1em" space-before.minimum="0.8em" > space-before.maximum="1.2em"> > ... > > BTW, in the .fo file the whole glossary is on the same line as the last > page of the regular text. In the fo version of regular text there are a > few hundred line breaks. > > > I insert the pagebreaks like this: > > <glossary> > <title>Woordenlijst</title> > <glossentry id="abc"> > ... > </glossentry> > <?pagebreak?> > <glossentry id="xyz"> > ... > </glossentry> > </glossary> > > > Some more magic required? > > -- > #>!$!%(@^%#%*(&(#@#*$^@^$##*#@&(%)@**$!(&!^(#((#&%!)%*@)(&$($$%(@#)&*!^$)^@* ^@) > > Tom Peters > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: docbook-apps-unsubscribe@lists.oasis-open.org > For additional commands, e-mail: docbook-apps-help@lists.oasis-open.org > > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]