Hi Luke,
Try something like...
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl
utput method="xml" indent="yes"/>
<xsl:template match="doc">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates select="page-break"/>
</xsl:copy>
</xsl:template>
<xsl:template match="doc/page-break">
<page>
<xsl:variable name="this-id" select="generate-id()"/>
<xsl:apply-templates
select="preceding-sibling::node()[generate-id(following-sibling:
age-break)
= $this-id]"/>
</page>
<xsl:if test="not(following-sibling:
age-break)">
<page>
<xsl:apply-templates select="following-sibling::node()"/>
</page>
</xsl:if>
</xsl:template>
<xsl:template match="*">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="@* | text() | comment() | processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator