Rev | Author | # | Line |
---|---|---|---|
5 | MuenchianMethod | 1 | The MuenchianMethod is a technique in [XSLT], which could probably also be applied to other data-centric Category:FunctionalProgrammingLanguages. It was developed/discovered by Steve Muench. |
2 | StuartYeates | 2 | |
4 | AristotlePagaltzis | 3 | In [XSLT] a common problem is how to fire an action exactly once for each class of element seen. This is difficult in [XSLT] because it is a purely functional language and "remembering" that you've already seen an element of a class is impossible. There are certain highly recursive methods to solve the problem but these are incredibly inefficient, because (somewhat unusually for a functional language) [XSLT] is optimised not for recursion but for application of [Template]s to nodes in the [XML] tree. |
2 | StuartYeates | 4 | |
4 | AristotlePagaltzis | 5 | The MuenchianMethod avoids this problem using a key defined to classify elements into a class. Keys in [XSLT] are like indexes in SQL -- they are efficient. A good introduction to the MuenchianMethod can be [found on the web | http://www.jenitennison.com/xslt/grouping/index.xml]. |
2 | StuartYeates | 6 | |
4 | AristotlePagaltzis | 7 | As an example, the following code creates a key called kName based on the name of each node. The template then matches only those nodes which are the first node in the key with that name. |
2 | StuartYeates | 8 | |
9 | ... | ||
10 | <xsl:key name="kName" match="*" use="name()"/> | ||
11 | ... | ||
12 | <xsl:template match="*[generate-id() | ||
13 | = generate-id(key('kName', | ||
14 | name() | ||
15 | )[[1] | ||
16 | ) | ||
17 | ]"> | ||
18 | Element name: <xsl:value-of select="name()"/> | ||
19 | <xsl:apply-templates/> | ||
20 | </xsl:template> | ||
21 | ... |
lib/blame.php:177: Warning: Invalid argument supplied for foreach()