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

XSL/FOP: Implementing a counter with a recursive routi

Subject: XSL/FOP: Implementing a counter with a recursive routine
From: Rachael Blank <blankrr@xxxxxxxxxxxxxxxx>
Date: Thu, 08 Nov 2001 09:36:25 -0500
fop count
Hello! 

Thank you in advance for any and all assistance. We are using the Saxon
parser with FOP .19 

My XML looks like: 
<report> 
   <section> 
      <datatypeid></datatypeid> 
      <header></header> 
      <comment></comment> 
   <section> 
   <section> 
      <datatypeid></datatypeid> 
      <header></header> 
      <comment></comment> 
   <section> 
   <section> 
      <datatypeid></datatypeid> 
      <header></header> 
      <comment></comment> 
   <section> 
    .... 
 <report> 

In the stylesheet, I have: 
... 
<xsl:template name="LineNew"> 
    <xsl:param name="string" /> 
    <fo:block> 

    <xsl:if test="count(header) = '1'"> 
       <xsl:value-of select="header"/> 
       <xsl:value-of select="count(header)" /> 
       <!--I need to increment the header so that it does not equal 1
anymore.  --> 
    </xsl:if> 

    .....{more if statements}... 

      <xsl:if test="not(contains($string, '&#xA;'))"> 
         <xsl:value-of select="$string" /> 
      </xsl:if> 
    </fo:block> 
 </xsl:template> 

<xsl:template match="/"> 
.... 
<xsl:for-each select="report/section"> 
 <fo:table> 
     <fo:table-column column-width="6.5in"/> 
     <fo:table-body> 
         <fo:table-row> 
            <fo:table-cell> 
               <fo:block> 
               <xsl:call-template name="LineNew"> 
{This is where I had the <xsl:value-of select="header"/> which caused
the header and comment to be on separate lines} 
                   <xsl:with-param name="string" select="comment"/> 
               </xsl:call-template> 
               </fo:block> 
        </fo:table-cell> 
     </fo:table-row> 
  </fo:table-body> 
  </fo:table> 
  </xsl:otherwise> 
  </xsl:choose> 
  </xsl:for-each> 
... 
</xsl:template> 

If I put a <xsl:value-of select="header"> in before the <xsl:with-param
name="string" select="comment"/>
statement, I get the following: 

header 
comment 

header 
comment 
.... 

I need to have header and comment on the same line like the following: 
header comment 
header comment 
... 

It appears that the "call-template" statement is putting in a line feed
which I do not want. 

As the code stands now, I am printing a header for every "if condition"
that follows it. 

Here's what I want to happen: 
Call the LineNew template.   Print the first header.  Add a 1 to the
header count then pass through the rest of the "if statements" which
test for different conditions within the comment and print the comment.
This process happens recursively. 

If there is another, easier way to suppress the unwanted line feed
without this alternative, I would be glad to hear it.

Thanks!! 

Rachael

 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.