[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] First positional grouping
This is my first attempt at positional grouping and I'm almost there. I'd like to transform
into <!-- desiredResult.xml --> <varList VGID="AA" label="Families"/> <var label="Fathers"/> <var label="Mothers"/> </varList> <varList VGID="AB" label="Relatives"/> <var label="Inlaws/> </varList> by promoting all <vars> with a @VGID. I'm following the example at http://www.dpawson.co.uk/xsl/sect2/N4486.html#d4085e229 Using the following style sheet, <!-- myStyleSheet.xsl --> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="root"> <root> <xsl:for-each select="var[@VGID]"> <varList> <xsl:apply-templates select="@*"/> <xsl:for-each select="following-sibling::var[ count(preceding-sibling::var[@VGID][1] | current()) = 1]"> <xsl:copy-of select="."/> </xsl:for-each> </varList> </xsl:for-each> </root> </xsl:template> <xsl:template match="@*|node()" priority="-1"> <xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy> </xsl:template> </xsl:stylesheet>
which has an extra third node under the first <varList>. Can someone help me get rid of the extra node? It should be a matter of just amending the XPATH in the inner for-each.
_________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|