Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 2nd, 2008, 09:37 AM
Authorized User
 
Join Date: May 2008
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Alright, here we go:
the only thing you needed to amend in the stylesheet provided for you by Alain is to add a check whether this is a first pagebreak processed, and if yes - add there one more <div> with all the preceding elements, e.g. using <xsl:if>:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="div">
        <div class="article-content-container">
            <xsl:for-each select="pagebreak">
                <xsl:if test="position()=1">
                    <div class="page-content-container">
                        <xsl:copy-of select="preceding-sibling::*"/>
                    </div>
                </xsl:if>
                <xsl:copy-of select="."/>
                <xsl:variable name="nbpg" select="position()"/>
                <div class="page-content-container">
                    <xsl:copy-of select="following-sibling::*[name()!='pagebreak' and count(preceding-sibling::pagebreak)=$nbpg]"/>
                </div>
            </xsl:for-each>
        </div>
    </xsl:template>
</xsl:stylesheet>
 
Old July 3rd, 2008, 03:20 PM
Registered User
 
Join Date: Apr 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Frimann
Default

Thanks for the solutions Martin and Volder. I ended up using Volder's as it iplemented in my existing XSLT without fuss. I tried Martins too, but I couldn't get it to work in my design =/

XSLT is really giving me a hard time! I can't seem to grasp the logic.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Not outputting a specific node zach_1988 XSLT 3 December 2nd, 2008 10:49 AM
retrieving information from a parent node Tomi XSLT 2 September 6th, 2006 06:54 AM
Finding parent node Chamkaur XSLT 4 August 9th, 2006 06:26 AM
How to delete an element and parent node. crossedge XSLT 1 March 14th, 2006 05:10 AM
Saving the parent node Doyle Bradely XML 2 December 23rd, 2003 07:05 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.