You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Jack Donohue <do...@synovation.com> on 2002/05/08 18:18:36 UTC
Newbie question - underlining blank spaces.
Hi all.
Is there any way to force FOP to underline a string, even if it is composed
entirely of blank characters? I'm using fop-0.20.3, if that matters.
I have a template which produces an underlined, fixed-length string in my
pdf doc. It pads the string with spaces if necessary to make it the desired
length. It works great, and a I get a padded string in the pdf document with
the required length and everything is underlined. Great :-)
The problem is when the string is composed entirely of blank spaces ... The
string has the correct number of blank characters
(white-space-collapse=false), but the string is not underlined.
Is there a way to force FOP to underline a string, even if it is composed
entirely of blank characters?
Thanks for any help.
Here is the template:
<!-- *** this is the format I want to use to display the string -->
<xsl:attribute-set name="dataText">
<xsl:attribute name="font-family">Courier</xsl:attribute>
<xsl:attribute name="font-size">9pt</xsl:attribute>
<xsl:attribute name="font-style">normal</xsl:attribute>
<xsl:attribute name="font-weight">normal</xsl:attribute>
<xsl:attribute name="language">en-US</xsl:attribute>
<xsl:attribute name="text-decoration">underline</xsl:attribute>
<xsl:attribute name="white-space-collapse">false</xsl:attribute>
</xsl:attribute-set>
<!-- recursive template to pad a string with blanks -->
<xsl:template name="append-pad">
<!-- the value with whatever padChar is passed in -->
<xsl:param name="padChar"><xsl:value-of select="' '"/></xsl:param>
<xsl:param name="padVar"/>
<xsl:param name="length"/>
<xsl:choose>
<!-- **** check here to see if the padVar is nil -->
<xsl:when test="boolean($padVar)">
<xsl:choose>
<xsl:when test="string-length($padVar) < $length">
<xsl:call-template name="append-pad">
<xsl:with-param name="padChar" select="$padChar"/>
<xsl:with-param name="padVar"
select="concat($padVar,$padChar)"/>
<xsl:with-param name="length" select="$length"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise><fo:inline
xsl:use-attribute-sets="dataText"><xsl:value-of
select="concat(substring($padVar,1,$length),' ')"/></fo:inline></xsl:ot
herwise>
</xsl:choose>
</xsl:when>
<!-- *** if the padVar is nil, make a string of entirely blank space
*** -->
<xsl:otherwise>
<xsl:call-template name="append-pad">
<xsl:with-param name="padChar" select="$padChar"/>
<xsl:with-param name="padVar" select="' '"/>
<xsl:with-param name="length" select="$length"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
------------------------------------------------------------------
Jack Donohue, Developer
Synovation Incorporated.
Providing integrated solutions for criminal justice.
------------------------------------------------------------------
Tel 209.491.0978 x 409
Fax 209.571.8853
Support 209.491.3600
Toll Free 800.774.8430
------------------------------------------------------------------
http://www.synovation.com
http://support.synovation.com
Re: Newbie question - underlining blank spaces.
Posted by "J.Pietschmann" <j3...@yahoo.de>.
Jack Donohue wrote:
> Is there any way to force FOP to underline a string, even if it is composed
> entirely of blank characters? I'm using fop-0.20.3, if that matters.
Try something which results in
<fo:inline text-decoration="underline">_  </fo:inline>
The first is the underline character, the last a non breaking
space.
J.Pietschmann