[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Copy and group XML
This problem is a bit under-specified. Where should non-scene material fall in the output? Inside the acts, between the acts? -Brandon :) On Wed, Jan 26, 2011 at 1:22 PM, Jacobus Reyneke <jacobusreyneke@xxxxxxxxx> wrote: > Good day, could someone please tell me what I'm doing wrong here. > > I'm trying to copy a XML document with 'play' as route. While doing so > I need to group the 'scene' elements under 'act'. The xsl below works > (almost), but throws out anything that falls under play, but outside > of a scene. I need to preserve (copy) elements that are outside of > 'scene'. > > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xs="http://www.w3.org/2001/XMLSchema" > exclude-result-prefixes="xs" > version="2.0"> > > <xsl:template match="play"> > <xsl:for-each-group select="scene" > group-by="@act"> > <act> > <xsl:for-each select="current-group()"> > <xsl:copy> > <xsl:apply-templates select="@*|node()"/> > </xsl:copy> > </xsl:for-each> > </act> > </xsl:for-each-group> > </xsl:template> > > <xsl:template match="@*|node()"> > <xsl:copy> > <xsl:apply-templates select="@*|node()"/> > </xsl:copy> > </xsl:template> > > </xsl:stylesheet> > > Kind regards, > Jacobus
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|