Re: Grouping issue - multiple page break locations
M V wrote:
I've run into some problems with grouping that I hope someone can help me through. I've read just about every article and FAQ on grouping that I've been able to locate. I've also been through Michael Kay's and Jeni Tennison's books. I haven't been able to apply any of the examples successfully to this particular variation.
You only have two problems with this, the fact that page elements are mis-nested, and the fact that the follow-on paras need to be treated specially. You'll find something like the following works:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- find first page - we have to step through to avoid nesting problems -->
<!-- create a page element -->
<!-- and turn any continuation text into a new paragraph -->
<xsl:if test="normalize-space(following-sibling::text()) != ''">
<!-- find all the paragraphs for *this* page, which could be children or following elements -->
<xsl:apply-templates select="(child::para | following::para)[preceding::page/@number = current()/@number]"/>
<!-- now step through to next page -->
<!-- only print out first text node, in case of embedded page element -->
<xsl:value-of select="child::text()" />
Hope this helps -
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format