1 | <?xml version="1.0" encoding="utf-8"?> |
---|
2 | <xsl:stylesheet |
---|
3 | version="1.0" |
---|
4 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
---|
5 | <!-- |
---|
6 | <purpose> convert fsls to html-list-snippet</purpose> |
---|
7 | <params> |
---|
8 | <param name=""></param> |
---|
9 | </params> |
---|
10 | <history> |
---|
11 | <change on="2010-06-22" type="created" by="vr">based on fsls2view.xsl</change> |
---|
12 | </history> |
---|
13 | <sample> result |
---|
14 | <ul id="browser" class="filetree treeview-famfamfam treeview"> |
---|
15 | <li><span class="folder">Folder 1</span> |
---|
16 | <ul> |
---|
17 | <li><span class="folder">Item 1.1</span> |
---|
18 | <ul> |
---|
19 | </sample> |
---|
20 | --> |
---|
21 | |
---|
22 | <xsl:import href="cmd_commons.xsl" /> |
---|
23 | |
---|
24 | <!-- <xsl:output method="xml" /> --> |
---|
25 | |
---|
26 | <xsl:param name="max_depth">0</xsl:param> |
---|
27 | <xsl:param name="sort">name</xsl:param> <!-- s=size|n=name|t=time --> |
---|
28 | <xsl:param name="style_dir" /> |
---|
29 | <xsl:param name="basedir" >../..</xsl:param> |
---|
30 | <xsl:param name="format" /> |
---|
31 | |
---|
32 | <xsl:decimal-format name="european" decimal-separator=',' grouping-separator='.' /> |
---|
33 | |
---|
34 | <xsl:param name="title" >Collections Index: <xsl:value-of select="/Collections/@root"/></xsl:param> |
---|
35 | |
---|
36 | <xsl:template name="callback-header" > |
---|
37 | <style type="text/css"> |
---|
38 | #collectionstree { margin-left: 10px; border: 1px solid #9999aa; border-collapse: collapse;} |
---|
39 | .number { text-align: right; } |
---|
40 | td { border-bottom: 1px solid #9999aa; padding: 1px 4px;} |
---|
41 | .treecol {padding-left: 1.5em;} |
---|
42 | table thead {background: #ccccff; font-size:0.9em; } |
---|
43 | table thead tr th { border:1px solid #9999aa; font-weight:normal; text-align:left; padding: 1px 4px;} |
---|
44 | } |
---|
45 | </style> |
---|
46 | <script type="text/javascript" > |
---|
47 | $(function(){ |
---|
48 | $("#collectionstree").treeTable(); |
---|
49 | }); |
---|
50 | </script> |
---|
51 | </xsl:template> |
---|
52 | |
---|
53 | <xsl:template name="continue-root" > |
---|
54 | <xsl:choose> |
---|
55 | <xsl:when test="$format='collection2htmlpage'" > |
---|
56 | <div id="collections"> |
---|
57 | <table id="collectionstree" > |
---|
58 | <thead> |
---|
59 | <tr><th class="treecol">Name</th><th>Count (visible) Subcoll</th><th>Count Resources</th><th>Handle</th></tr> |
---|
60 | </thead> |
---|
61 | <xsl:apply-templates select="*/c" mode="detail"> |
---|
62 | <xsl:sort order="ascending" select="@n" /> |
---|
63 | </xsl:apply-templates> |
---|
64 | </table> |
---|
65 | </div> |
---|
66 | </xsl:when> |
---|
67 | <xsl:otherwise> |
---|
68 | <div> |
---|
69 | <ul class="treeview"> |
---|
70 | <xsl:apply-templates select="*" > |
---|
71 | <xsl:sort order="ascending" select="@n" /> |
---|
72 | </xsl:apply-templates> |
---|
73 | </ul> |
---|
74 | </div> |
---|
75 | </xsl:otherwise> |
---|
76 | </xsl:choose> |
---|
77 | |
---|
78 | </xsl:template> |
---|
79 | |
---|
80 | <xsl:template match="c" > |
---|
81 | <xsl:variable name="lv" select="count(ancestor::c)" /> |
---|
82 | |
---|
83 | <li> |
---|
84 | <span class="cmd cmd_load"> </span> |
---|
85 | <label class="showselection" count="0" some_selection="0" >o</label> |
---|
86 | <input type="checkbox" class="selection" child="undefined" /> |
---|
87 | <span class="folder" > |
---|
88 | <xsl:attribute name="handle"> |
---|
89 | <xsl:value-of select="@handle"/> |
---|
90 | </xsl:attribute> |
---|
91 | <xsl:value-of select="@n" /></span> |
---|
92 | <span class="note"> |<xsl:value-of select="@cnt" />|</span> |
---|
93 | <!-- |
---|
94 | <span class="folder"><xsl:value-of select="@n" />(<xsl:value-of select="@cnt" />) |
---|
95 | </span> |
---|
96 | --> |
---|
97 | |
---|
98 | <xsl:if test="c and ($lv<$max_depth or $max_depth=0)"> |
---|
99 | <ul> |
---|
100 | <xsl:choose> |
---|
101 | <xsl:when test="$sort='s'"> |
---|
102 | <xsl:apply-templates select="c" > |
---|
103 | <xsl:sort order="descending" select="@cnt" data-type="number" /> |
---|
104 | </xsl:apply-templates> |
---|
105 | </xsl:when> |
---|
106 | <xsl:otherwise> |
---|
107 | <xsl:apply-templates select="c" > |
---|
108 | <xsl:sort order="ascending" select="@n" /> |
---|
109 | </xsl:apply-templates> |
---|
110 | </xsl:otherwise> |
---|
111 | </xsl:choose> |
---|
112 | </ul> |
---|
113 | |
---|
114 | </xsl:if> |
---|
115 | </li> |
---|
116 | </xsl:template> |
---|
117 | |
---|
118 | <xsl:template match="c" mode="detail" > |
---|
119 | <xsl:param name="parentid" select="'c-'" /> |
---|
120 | |
---|
121 | <xsl:variable name="lv" select="count(ancestor::c)" /> |
---|
122 | |
---|
123 | <xsl:variable name="cid" > |
---|
124 | <xsl:choose> |
---|
125 | <xsl:when test="$lv=0"><xsl:value-of select="concat($parentid,position())" /></xsl:when> |
---|
126 | <xsl:otherwise><xsl:value-of select="concat($parentid,'-', position())" /></xsl:otherwise> |
---|
127 | </xsl:choose> |
---|
128 | </xsl:variable> |
---|
129 | |
---|
130 | <tr id="{$cid}" > |
---|
131 | <xsl:if test="$lv!=0" > |
---|
132 | <xsl:attribute name="class" select="concat('child-of-',$parentid)" /> |
---|
133 | </xsl:if> |
---|
134 | <td class="treecol" ><xsl:value-of select="@n" /></td> |
---|
135 | <td class="number"><xsl:value-of select="count(.//c)" /></td> |
---|
136 | <td class="number"><xsl:value-of select="@cnt" /></td> |
---|
137 | <td><xsl:value-of select="@handle" /></td> |
---|
138 | </tr> |
---|
139 | <xsl:if test="c and ($lv<$max_depth or $max_depth=0)"> |
---|
140 | |
---|
141 | <xsl:choose> |
---|
142 | <xsl:when test="$sort='s'"> |
---|
143 | <xsl:apply-templates select="c" mode="detail"> |
---|
144 | <xsl:with-param name="parentid" select="$cid" /> |
---|
145 | <xsl:sort order="descending" select="@cnt" data-type="number" /> |
---|
146 | </xsl:apply-templates> |
---|
147 | </xsl:when> |
---|
148 | <xsl:otherwise> |
---|
149 | <xsl:apply-templates select="c" mode="detail"> |
---|
150 | <xsl:with-param name="parentid" select="$cid" /> |
---|
151 | <xsl:sort order="ascending" select="@n" /> |
---|
152 | </xsl:apply-templates> |
---|
153 | </xsl:otherwise> |
---|
154 | </xsl:choose> |
---|
155 | |
---|
156 | </xsl:if> |
---|
157 | |
---|
158 | </xsl:template> |
---|
159 | |
---|
160 | |
---|
161 | </xsl:stylesheet> |
---|