[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Grouping issue - multiple page break locations

Subject: Re: Grouping issue - multiple page break locations
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Mon, 03 Feb 2003 23:15:56 +0000
find page number in xsl
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



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.