[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Table of contents for all groups at the beginning of e
I've looked at a lot of examples but I still can't seem to figure out how to do this. I am using XSLT 2.0. I am transforming XML to XHTML. The XML is something like this: <corporation> <company> <employee> <department>a</department> </employee> <employee> <department>a</department> </employee> <employee> <department>a</department> </employee> </company> <company> <employee> <department>a</department> </employee> <employee> <department>a</department> </employee> <employee> <department>b</department> </employee> <employee> <department>c</department> </employee> </company> </corporation> I need to group employees within a company (selected with a param) by department. No problem. What I also need to do is include a table of contents at the beginning of each department grouping linking to each of the other department groups. If there is only one department in the company, I do not display a table of contents. <xsl:for-each-group select="//company" group-by="department/text()"> <xsl:sort select="department/text()"/> <br/> <p><a id="<xsl:value-of select='current-grouping-key()'/>"></a></p> <h2><xsl:value-of select='current-grouping-key()'/></h2> <xsl:for-each select="current-group()"> <xsl:value-of select="current-grouping-key()"/> ...other stuff to display... <hr/> </xsl:for-each> </xsl:for-each-group> I think my problem is that I don't thoroughly understand how the XML doc is processed so that I can get the group names at the beginning of the the for-each-group. TIA for any help.
|
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
|