<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:apply-templates/>
	</xsl:template>

	<xsl:template match="node()">
		<xsl:copy-of select="."/>
		<xsl:apply-templates select="following-sibling::*[1]"/> 
	</xsl:template>

	<xsl:template match="*" mode="stopat">
	<xsl:param name="stopat"/>
		<xsl:copy-of select="."/>	
		<xsl:if test="generate-id(.) != generate-id($stopat)">
			<xsl:apply-templates select="following-sibling::*[1]" mode="stopat">
				<xsl:with-param name="stopat" select="$stopat"/>
			</xsl:apply-templates>
		</xsl:if>
	</xsl:template>

	<xsl:template match="line_first">
		<stanza>
			<xsl:copy-of select="."/>
			<xsl:apply-templates select="following-sibling::*[1]" mode="stopat">
				<xsl:with-param name="stopat" select="following-sibling::line_last[1]"/>
			</xsl:apply-templates>
		</stanza>
		<xsl:apply-templates select="following-sibling::line_last[1]/following-sibling::*[1]"/>
	</xsl:template>

	<xsl:template match="chapter">
		<xsl:copy>
			<xsl:apply-templates select="*[1]"/>
		</xsl:copy>
	</xsl:template>

</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2005. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="poetry.xml" htmlbaseurl="" outputurl="" processortype="saxon8" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->