[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Add a level of structure?
On Mon, 2005-06-20 at 09:32 +0300, George Cristian Bina wrote: > Hi Edmund, > > You can use something like below: > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > version="2.0"> > <xsl:output indent="yes"/> > <xsl:template match="a"> > <foo> > <xsl:apply-templates/> > </foo> > </xsl:template> > <xsl:template match="b"> > <bar> > <xsl:variable name="sortedCs"> > <xsl:for-each select="c"> > <xsl:sort select="c1" data-type="number"/> > <xsl:copy-of select="."/> > </xsl:for-each> > </xsl:variable> George is right, you'll want to take two passes at those <c> s. After that, you just need to go with: <baz> <x att="val" att2="val2"/> <y att="val" att2="val2"/> <xsl:apply-templates select="subsequence($sortedCs/*, 1, 3)"/> </baz> <baz> <q att="val" att2="val2"/> <r att="val" att2="val2"/> <xsl:apply-templates select="subsequence($sortedCs/*, 4, 3)"/> </baz> <baz> <g att="val" att2="val2"/> <h att="val" att2="val2"/> <xsl:apply-templates select="subsequence($sortedCs/*, 7, 3)"/> </baz> > <xsl:for-each select="$sortedCs/*"> > <xsl:if test="position() mod 3 =1"> > <baz> > <xsl:call-template name="specificContent"> > <xsl:with-param name="pos" select="(position()-1) div 3"/> > </xsl:call-template> > <xsl:apply-templates select="."/> > <xsl:apply-templates select="following-sibling::c[1]"/> > <xsl:apply-templates select="following-sibling::c[2]"/> > </baz> > </xsl:if> > </xsl:for-each> > </bar> > </xsl:template> But you'll probably want to do something like the above someday soon. sdc
|
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
|