Woops, that first <fo:table-cell>... tag below should have been removed.
Actually if you use this:
<xsl:for-each select="../customerPF[$row-num < position() and $row-num+4
> position()]">
instead of the xsl:for-each followed by 2 xsl:if-s below, our code might be
somewhat efficient after all. I just tested and it seems ok on first pass.
Apparently we were still learning our XSLT back then. Now comes the age-old
question of whether or not to rewrite code that works fine just because we know
it can be done better. I think that question usually comes down on the
do-not-rewrite side.
> -----Original Message-----
> From: Savino, Matt C
> Sent: Wednesday, May 14, 2003 11:47 AM
> To: [EMAIL PROTECTED]
> Subject: RE: Re: Error when piping XSL-FO to FOP driver using
> SAXResult
>
>
> Below is something we use as part of a much more involved
> stylesheet. Although looking at it now it's not the most
> efficient piece of code as it loops through the same nodes
> several times. (We use it to break output into groups of five
> columns and know we'll never have more than 3 or 4 groups, so
> we didn't need to worry about running through the same nodes
> a few extra times.)
>
> I think for efficiency and straighforwardness, the Steve
> Tinney example from the link in the previous post is probably
> the best way to go.
> (http://www.dpawson.co.uk/xsl/sect2/N4486.html#d4085e94)
>
> -matt
>
>
> [...]
> <fo:table-body>
>
> <xsl:for-each select="customerPF">
> <xsl:if test="(position()-1) mod 3 = 0">
>
> <xsl:call-template name="new-row">
> <xsl:with-param name="row-num" select="position() - 1" />
> </xsl:call-template>
>
> </xsl:if>
> <fo:table-cell><fo:block><xsl:value-of
> select="position()"/></fo:block></fo:table-cell>
> </xsl:for-each>
>
> </fo:table-body>
> [...]
>
>
> <xsl:template name="new-row">
> <xsl:param name="row-num"/>
>
> <fo:table-row>
>
> <xsl:for-each select="../customerPF">
> <xsl:if test="$row-num < position()">
> <xsl:if test="$row-num+4 > position()">
> <fo:table-cell><fo:block><xsl:value-of
> select="position()"/></fo:block></fo:table-cell>
> </xsl:if>
> </xsl:if>
> </xsl:for-each>
>
> </fo:table-row>
> <xsl:template>
>
>
>
> > Thanks for the response. Yes, its definitely a hack because I
> > could not put
> > a </fo:table-row> inside the <xsl:if> tag. I get an error
> > message saying
> > The element type "xsl:if" must be terminated by the matching end-tag
> > "</xsl:if>"
> >
> > Is there a better way to accomplish what I need to
> do...i.e. ouputting
> > portions of table-row tags depending on certain conditions? Thanks.
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]