|
Summary
Using the Muenchian method, the following snippet describes how to group your data, returning a distinct, unique list of data.
In many XSLT applications it is necessary to output only a single element that has a specific value (e.g. for an attribute, of a child, of a combination of attributes, of a combination of children, ..., etc.)
This method uses the fact that key(keyName, value) returns all the nodes, which are covered by the @match pattern of the xsl:key element with name=keyName, and for which the expression defined by the @use attribute of this xsl:key evaluates to value.
If we take only one (the first) node of each such group, then we have selected a subset of nodes, each having different value for the expression as defined in xsl:key.
This method was first proposed by Steve Muench and is known as the Muenchian method.
In the example below, all person elements are output, the name of which start with a new letter. The following names will be output:
Adrian Hayley Ian
| Further additional information | |
Updating comments...
Updating comments...
|
|