6. Internals of the XSLT script

The XSLT stylesheet homepage.xsl builds the Web pages that display the knowledge matrix.

File nav.xsl contains XSLT templates that place navigational links (such as ``Next,'' ``Previous,'' and so forth) on the top and bottom of the page. There is a small test driver script called nav-test.xsl that exercises nav.xsl for testing.

6.1. General structure of the application

Since Knowmat is technically part of the TCC help system, and since the help system is currently generated by WebStyler, the homepage.html page in the Knowmat directory is the point where the output we generate connects to the rest of the help system.

Unlike a typical XSLT stylesheet, this application makes extensive use of the <exsl:document> extension to write a set of pages:

6.2. The root ("/") template

The work done by the root template includes:

6.3. The skill-set template

This template processes the <skill-set> element of the input file. It does two things:

6.4. The make-major-page template

This named template creates one page displaying all the skill groups in a major heading.

It requires four parameters:


The URL of this page's parent.


The title of this page's parent.


The URL of the page to be generated, minus its suffix. The suffix is omitted so the child page names can be generated by adding a hyphen, and the child number, before the suffix is pasted back on.


The title of the page to be generated.

This template uses two small named templates called make-major-page-head and make-major-page-tail; these don't really do anything but prepare arguments for the standard navigational templates from nav.xsl.

6.5. The make-group-page template

This named template builds the page displaying all input <skill> elements in one <skill-group>.

The template requires four parameters:


The URL of the parent page, minus its suffix. The suffix is omitted so we can paste on a hyphen and the child position() to get the name of the child page.


The title of the parent page.


The URL of the page to be generated, without its suffix.


The title of the page to be generated.

6.6. The make-skill template

Each call to this template displays one <skill> element from the input file. It requires no parameters; the context element must be a <skill> element.

To group people by their skill level, this template calls the make-skill-level template three times, one for each possible skill level. That template produces output only if there is at least one <skilled> person at that level.

6.7. The people template

This template is invoked to process the people.xsl file, producing a page showing the TCC's departments with the people in that department listed underneath.

It needs two parameters: parent-url, the URL of the parent page, and parent-title, the parent page's title.

Within each department, an anchor named #g-N is generated, where N is the child number of that department. These anchors are used to link from the root page to the departments.

The output for each department is generated by the display-group template, which sorts the people in that department by last name (with first name as a tiebreaker).

A three-column table is used to vertically align the display of the names. The first column contains the login name of each person as a mailto: link. The second column shows their first name and the third column their surname. The second column is right-aligned to place the first name close to the surname.

If the <person> element had a href attribute, we also generate a link to that URL, which is the person's work homepage.

6.8. General remarks on XSLT

This was my first XSLT project of this size, and I'd like to offer a few reflections on the XSLT language that were shaped by this project.