[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] xsl-stylesheets: long titles / splitting gentext output
On Fri, Feb 06, 2004 at 11:29:28PM -0800, Bob Stayton wrote: > > But I'd rather have it look like > > > > 2.3.2 This is a title so long that it has to > > be broken onto the next line > > > > ^^^^^^ This space should be automatically adjusted to the width of the > > label > I've formatted section titles with number labels in the manner you want. > The trick is to customize a template earlier in the sequence to avoid > having the parse the string returned by the gentext machinery. [...] > The label.markup mode returns just the number label for the current element. > The title.markup mode returns just the title for the current element. > Those templates are used by the gentext machinery as well. Thanks a lot, that did it. I had to modify it slightly to fit into the section/title template in titlepage.mode. There I've inserted the following: <!-- get our own label markup without gentext --> <xsl:variable name="label"> <xsl:apply-templates select="$section" mode="label.markup"> <xsl:with-param name="allow-anchors" select="1"/> </xsl:apply-templates> <xsl:text>. </xsl:text> </xsl:variable> <xsl:variable name="label.length"> <xsl:value-of select="concat(string-length($label), 'em*0.37')"/> </xsl:variable> <!-- change title from flat string to list/table, section.heading will xsl:copy-of it into place --> <xsl:variable name="title"> <fo:list-block provisional-label-separation="0.2em" provisional-distance-between-starts="{$label.length}"> <fo:list-item> <fo:list-item-label end-indent="label-end()" text-align="start"> <fo:block> <xsl:copy-of select="$label"/> </fo:block> </fo:list-item-label> <fo:list-item-body start-indent="body-start()"> <fo:block hyphenation-remain-character-count="5" hyphenation-push-character-count="5"> <xsl:apply-templates select="$section" mode="title.markup"> <xsl:with-param name="allow-anchors" select="1"/> </xsl:apply-templates> </fo:block> </fo:list-item-body> </fo:list-item> </fo:list-block> </xsl:variable> It works fine and the estimate of length(label)*0.37 is surprisingly close to what it looked like with just a space. Thanks again. -- bye, Micha
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]