Re: [xsl] Grouping issue - multiple page break locations

Subject: Re: [xsl] Grouping issue - multiple page break locations
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Mon, 03 Feb 2003 23:15:56 +0000
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="";>
<xsl:output indent="yes"/>

<xsl:template match="book">
<!-- find all the pages, ignore how they're nested in each other or in paras -->
<xsl:apply-templates select="descendant::page"/>

<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()) != ''">
<xsl:value-of select="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[1]/@number = current()/@number]"/>

<xsl:template match="para">
<!-- only print out first text node, in case of embedded page element -->
<xsl:value-of select="child::text()[1]" />


That's better!


XSL-List info and archive:

Current Thread