[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Generating book index via attributes...
Dave Carvell wrote:
(Using XMLSpy Enterprise Edition version 2010 rel. 2, xsl 1.0) Maybe the following does what you want but I am guessing as to what you want to achieve: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:output method="html" indent="yes"/> <xsl:key name="refs1Key" match="indxref/@refs1" use="."/> <xsl:key name="refs2Key" match="indxref/@refs2" use="concat(../@refs1, '|', .)"/> <xsl:key name="refs3Key" match="indxref/@refs3" use="concat(../@refs1, '|', ../@refs2, '|', .)"/> <xsl:template match="docroot"> <xsl:apply-templates select="//indxref/@refs1[generate-id() = generate-id(key('refs1Key', .)[1])]" mode="group"> <xsl:sort select="."/> </xsl:apply-templates> </xsl:template> <xsl:template match="@refs1" mode="group"> <xsl:value-of select="."/> <br/> <xsl:apply-templates select="key('refs1Key', .)/../@refs2[generate-id() = generate-id(key('refs2Key', concat(../@refs1, '|', .))[1])]" mode="group"> <xsl:sort select="."/> </xsl:apply-templates> </xsl:template> <xsl:template match="@refs2" mode="group"> <br/>....<xsl:value-of select="." /><br/> <xsl:apply-templates select="key('refs2Key', concat(../@refs1, '|', .))/../@refs3[generate-id() = generate-id(key('refs3Key', concat(../@refs1, '|', ../@refs2, '|', .))[1])]" mode="group"> <xsl:sort select="."/> </xsl:apply-templates> </xsl:template> <xsl:template match="@refs3" mode="group"> <br/>........<xsl:value-of select="." /><br/> </xsl:template> </xsl:stylesheet> -- Martin Honnen http://msmvps.com/blogs/martin_honnen/
|
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
|