[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [docbook-apps] How to avoid a line break in a <phrase>
On 2/8/07, Ron Catterall <ron@catterall.net> wrote:
> I want to use the role attribute on <phrase> to do something like
>
> <para>Some content <phrase role="keeptogether">qwerty asdf
> zxcvbn</phrase> some more content</para>
>
> to avoid any line-breaks being generated in the <phrase> content when
> I produce a PDF file. (A sort in in-line equivalent of
> <literallayout>?)
To the folks who didn't use this:
Couldn't you use fo:keep-together.within-line="true"
http://www.w3.org/TR/xsl/#keep-together
Ron:
Here's a not very elegant solution I won't recommend:
Modify an inline.* template
<!-- yeah, this should be reworked, it's just an example- ->
<xsl:template name="inline.monoseq">
<xsl:param name="no-hyphenate" select="false()"/>
<xsl:param name="content">
<xsl:apply-templates/>
</xsl:param>
<fo:inline xsl:use-attribute-sets="monospace.properties">
<xsl:if test="@role[contains(., 'keep-together')]">
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
<xsl:attribute name="hyphenate">false</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$no-hyphenate">
<xsl:attribute name="keep-together.within-line">always</xsl:attribute>
<xsl:attribute name="hyphenate">false</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<!-- this is a zero-width space to intentionally provoke
an AntennaHouse bug.
The FO spec says that hyphenation-character can
only be on fo:block and
fo:character, but having anything her provides the
correct result. -->
<xsl:attribute name="hyphenation-character">
<xsl:value-of select="'​'"/>
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:when test="ancestor::footnote">
<xsl:attribute name="font-size">90%</xsl:attribute>
</xsl:when>
</xsl:choose>
<xsl:if test="@dir">
<xsl:attribute name="direction">
<xsl:choose>
<xsl:when test="@dir = 'ltr' or @dir = 'lro'">ltr</xsl:when>
<xsl:otherwise>rtl</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
</xsl:if>
<xsl:copy-of select="$content"/>
</fo:inline>
</xsl:template>
HTH,
Keith
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]