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.
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--