This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
XSL/FOP:Implementing a counter within a recursive routine
- To: xsl-list at lists dot mulberrytech dot com
- Subject: [xsl] XSL/FOP:Implementing a counter within a recursive routine
- From: Rachael Blank <blankrr at mars-systems dot com>
- Date: Thu, 08 Nov 2001 10:01:21 -0500
- Reply-To: xsl-list at lists dot mulberrytech dot com
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, '
'))">
<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