[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Linefeed-treatment in fop 0.20.4

Subject: Linefeed-treatment in fop 0.20.4
From: RShonk@xxxxxxxxxxxxx
Date: Tue, 19 Nov 2002 16:12:04 -0500
fop linefeed treatment
Can anyone tell me if there is an easier way to do this? My NOTE_TEXT node
is returned from an Oracle blob object which contains line-feed characters
and is multi-line. When rendering the linefeed '\n' was ignored and
everything ended up on one line. I tried to use linefeed-treatment and
white-space-treatment = "preserve", but these are not yet implemented in
fop 0.20.4
Here is the xslt workaround I came up with to get the multiline results I
was looking for, but there has got to be an easier way.

<?xml version="1.0"?>

<xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:fo="http://www.w3.org/1999/XSL/Format"
     xmlns:Date="xalan://java.util.Date"
     xmlns:Token="xalan://java.util.StringTokenizer">

--- trimmed header / fo:table nodes ---

              <fo:table-cell>
                <xsl:apply-templates select="NOTE_TEXT">
                  <xsl:with-param name="noteToken" select
="Token:new(NOTE_TEXT,'&#10;')"/>
                </xsl:apply-templates>
              </fo:table-cell>

<xsl:template match="NOTE_TEXT">
  <xsl:param name="noteToken"/>
  <xsl:call-template name="note.loop">
    <xsl:with-param name="i" select="1"/>
    <xsl:with-param name="noteMax" select="Token:countTokens($noteToken)"/>
    <xsl:with-param name="noteToken" select="$noteToken"/>
  </xsl:call-template>
</xsl:template>

<xsl:template name="note.loop">
  <xsl:param name="i"/>
  <xsl:param name="noteMax"/>
  <xsl:param name="noteToken"/>
  <xsl:if test="$i &lt;= $noteMax">
    <fo:block>
      <xsl:value-of select="Token:nextToken($noteToken)"/>
    </fo:block>
    <xsl:if test="$i &lt; $noteMax">
      <xsl:call-template name="note.loop">
        <xsl:with-param name="i" select="$i + 1"/>
        <xsl:with-param name="noteMax" select="$noteMax"/>
        <xsl:with-param name="noteToken" select="$noteToken"/>
      </xsl:call-template>
    </xsl:if>
  </xsl:if>
</xsl:template>

Thanks in advance,
Richard Shonk
Flowserve Corp.
Programmer / Analyst
Parts Distribution Center
Moosic, Pa.
(570) 451-2225


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.