| 
 
Subject: [xsl] Table of contents for all groups at the beginning of each  group From: <vwiswell@xxxxxxxxxxx> Date: Mon, 19 Nov 2007 12:50:20 -0600 (CST)  | 
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.
| Current Thread | 
|---|
  | 
| <- Previous | Index | Next -> | 
|---|---|---|
| Re: [xsl] Header Text Overflows Bod, G. Ken Holman | Thread | Re: [xsl] Table of contents for all, G. Ken Holman | 
| Re: [xsl] xml to xml issue in XSLT2, G. Ken Holman | Date | Re: [xsl] xml to xml issue in XSLT2, chun ji | 
| Month |