|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Grouping issue - multiple page break locations
Francis Norton wrote:
<something excessively complicated> this solution solves the same two problems but without the unnecessary complexity of my first clumsy effort <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes"/> <xsl:template match="book"> <book> <!-- find all the pages, ignore how they're nested in each other or in paras --> <xsl:apply-templates select="descendant::page"/> </book> </xsl:template> <xsl:template match="page"> <!-- create a page element --> <page number="{@number}"> <!-- and turn any continuation text into a new paragraph --> <xsl:if test="normalize-space(following-sibling::text()) != ''"> <para> <xsl:value-of select="following-sibling::text()"/> </para> </xsl:if> <!-- find all the paragraphs for this page, which could be children or following elements --> <xsl:apply-templates select="(child::para | following::para)[preceding::page[1]/@number = current()/@number]"/> </page> </xsl:template> <xsl:template match="para"> <para> <!-- only print out first text node, in case of embedded page element --> <xsl:value-of select="child::text()[1]" /> </para> </xsl:template> </xsl:stylesheet> That's better! Francis. 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
|

Cart








