File: sort.xsl

package info (click to toggle)
kompozer 1%3A0.8~b3.dfsg.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 283,956 kB
  • ctags: 314,166
  • sloc: cpp: 1,763,181; ansic: 990,028; xml: 97,969; makefile: 46,334; asm: 34,989; perl: 26,943; sh: 20,165; cs: 6,232; java: 5,513; python: 3,221; pascal: 340; lex: 306; php: 244; csh: 132; objc: 97; yacc: 79; ada: 49; awk: 14; sql: 4; sed: 4
file content (60 lines) | stat: -rw-r--r-- 1,521 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?xml version="1.0"?>
<xsl:stylesheet
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<!-- for read-ability use HTML output and enable indenting -->
<xsl:output method="html" indent="yes"/>

<!-- matches document node -->
<xsl:template match="/">
   <HTML>
      <HEAD>
         <TITLE>A simple sorting example</TITLE>
      </HEAD>
      <BODY>
         <P ALIGN="CENTER">
            <B>
               <FONT SIZE="+2">A simple sorting example</FONT>
               <HR SIZE="1"/>
            </B>
         </P>
         <!-- select and apply templates to remaining document -->
         <xsl:apply-templates/>
      </BODY>
   </HTML>
</xsl:template>

<!-- matches root element -->
<xsl:template match="/*">
   <TABLE BORDER="0">
   <TR><TD>Sorting in ascending order</TD></TR>
   <TR>
      <TD>
         <OL>
            <xsl:apply-templates>
               <!-- sort using the value of the selected node -->
               <xsl:sort select="."/>
            </xsl:apply-templates>
         </OL>
      </TD>
   </TR>
   <TR><TD>Sorting in descending order</TD></TR>
   <TR>
      <TD>
         <OL>
            <xsl:apply-templates>
               <!-- sort using the value of the selected node -->
               <xsl:sort select="." order="descending"/>
            </xsl:apply-templates>
         </OL>
      </TD>
   </TR>
   </TABLE>
</xsl:template>

<!-- matches only entry elements -->
<xsl:template match="entry">
    <LI><xsl:apply-templates/></LI>
</xsl:template>

</xsl:stylesheet>