On 26 Mar 2009, at 19:23, Sam Fuqua wrote:
Hi
An XSLT question that, strictly speaking does not belong on this list,
but anyway...
I'm generating a PDF from an xml feed. The feed has a list of
items, and I want each new item on a new page, but I don't want the
last page to break onto a new blank page. How would I do this?
Right now, I have the following:
<xsl:template match="item">
<fo:block xmlns:fo="http://www.w3.org/1999/XSL/Format" break-
after="page">
<-- call other templates -->
</fo:block>
</xsl:template>
Do something like:
<xsl:template match="item">
<fo:block>
<xsl:if test="not(position()=last())">
<xsl:attribute name="break-after">page</xsl:attribute>
</xsl:if>
<!-- call other templates -->
</fo:block>
</xsl:template>
Careful, because you're using a plain 'apply-templates' on the higher
level, and that would include possible text-nodes... If the above
doesn't work, try using: <xsl:apply-templates select="*"/> instead.
That only selects the element nodes, and hence produces 'expected'
results for position() and last().
HTH!
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]