[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] Centering lines of text in FO output
Hi Ron, I was suggesting that a role attribute on literallayout could be used: <literallayout role="SpecialStuff"> line 1 a longer line 2 </literallayout> and the stylesheet customization would look like this: <xsl:attribute-set name="verbatim.properties"> <xsl:attribute name="text-align"> <xsl:choose> <xsl:when test="@role = 'SpecialStuff'">center</xsl:when> <xsl:otherwise>start</xsl:otherwise> </xsl:choose> </xsl:attribute> </xsl:attribute-set> That should have been sufficient, but it didn't work when I tried it. Further investigation showed that the template that matches literallayout adds its own text-align="start" property to the fo:block, which overrides the attribute-set. Ugh. So you have to also customize the template with match="literallayout" from fo/verbatim.xsl to remove its text-align property so the attribute-set can work. <xsl:otherwise> <fo:block id="{$id}" wrap-option='no-wrap' white-space-collapse='false' white-space-treatment='preserve' => text-align='start' linefeed-treatment="preserve" xsl:use-attribute-sets="verbatim.properties"> <xsl:copy-of select="$content"/> </fo:block> </xsl:otherwise> That property really ought to be in the attribute-set so it can be more easily changed. Bob Stayton Sagehill Enterprises DocBook Consulting bobs@sagehill.net ----- Original Message ----- From: "Ron Catterall" <ron@catterall.net> To: "Bob Stayton" <bobs@sagehill.net> Cc: <docbook-apps@lists.oasis-open.org> Sent: Wednesday, December 06, 2006 12:20 PM Subject: Re: [docbook-apps] Centering lines of text in FO output > Bob > No it doesn't have to be a para, in fact preferably not. As I saw it, > the problem with literallayout is that it is 'literal' and I thought I > had to count spaces etc. so that if I change page size that's a hassle. > Setting it up as a table I have to use negative row-heights (which is > illegal, but works OK with XEP) and there is more code than content and I > have to juggle to get it out of the LOT. > > Are you suggesting I set up PI to handle a pseudo-attribute? > > Would something like this do it: > > <literallayout> <?dbfo-justification role="centered" ?> > line 1 > a longer line 2 > etc > </literallayout> > > with, in the customization layer: > > <xsl:variable name="role"> > <xsl:call-template name="dbfo-attribute"> > <xsl:with-param name="pis" > > select="ancestor-or-self::entry/processing-instruction('dbfo')" /> > <xsl:with-param name="attribute" select="'role'" /> > </xsl:call-template> > </xsl:variable> > > <xsl:attribute-set name="verbatim.properties"> > <xsl:attribute name="role"> > <xsl:choose> > <xsl:when test="processing-instruction('dbfo-justification')"> > <xsl-value-of > select="processing-instruction('dbfo-justification')" /> > </xsl:when> > <xsl:otherwise>inherit</xsl:otherwise> > </xsl:choose> > </xsl:attribute> > </xsl-attribute-set> > > I can't see how the centering gets applied. Sorry, I'm trying to hack > some code together without really understanding it. > > Ron > >>>> Bob wrote: > Does it have to be a para? The processing expectations for para are to > flow the text into the available space, not preserve line endings. Your > example looks like a literallayout, where line endings are preserved. > With a role attribute on the literallayout you could customize the > attributes in the 'verbatim.properties' attribute-set to add a centering > property. > <<< > > -- > Ron Catterall, Phd, DSc email: ron@catterall.net > Prolongacion de Hidalgo 140 http://catterall.net/ > San Felipe del Agua tel: +52 951 520 1821 > Oaxaca 68020 Mexico fax: +1 530 348 8309 > >
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]