<?xml version="1.0"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <forwardslash> <xsl:apply-templates select="*"/> </forwardslash> </xsl:template> <xsl:template match="backslash"> <xsl:for-each-group select="story" group-by="section"> <section> <title><xsl:value-of select="current-group()/section"/></title> <xsl:apply-templates select="."/> </section> </xsl:for-each-group> </xsl:template> <xsl:template match="story"> <story> <xsl:apply-templates/> </story> </xsl:template> <xsl:template match="*"> <xsl:copy-of select="."/> </xsl:template> <xsl:template match="section"/> </xsl:stylesheet>