[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

Subject: 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)
 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="&lt;xsl:value-of
select='current-grouping-key()'/&gt;"></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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.