source: MDService2/trunk/MDService2/src/xsl/complist2terms.xsl

Last change on this file was 765, checked in by vronk, 14 years ago

adding model2matrix.xsl, appropriate changes to model2view.xsl

File size: 10.4 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<xsl:stylesheet
3  version="2.0"
4  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5  xmlns:xs="http://www.w3.org/2001/XMLSchema"
6  xmlns:my="myFunctions"
7  xmlns:dcif="http://www.isocat.org/ns/dcif"   
8>
9<!--
10<purpose> generate lists for Terms (CMDI-Elements, CMDI-components, Datcats)
11 based on the Components-list (provided by CompReg).
12                strategy:  regard CMD_Component, CMd_Element, ConceptLink</purpose>
13<params>
14<param name="isocat_file">the DCIF-Metadata-Profile</param>
15</params>
16<history>
17        <change on="2010-07-10" type="created" by="vr">from complist2stats.xsl</change>
18</history>
19-->
20<xsl:include href="cmd_commons.xsl"/>
21   
22<xsl:param name="isocat_file" select="'../DCR/isocat_profile_5_dcif.xml'" />
23
24<xsl:param name="title" select="'Terms'" />
25
26<xsl:variable name="isocat" select="document($isocat_file)" />
27
28<xsl:variable name="concepts_nolang" 
29        select="//@ConceptLink[not(starts-with(.,'http://cdb.iso.org/lg/'))]" />
30
31
32
33<xsl:template name="continue-root">
34                <!--  <ul class="treeview"> -->
35                <xsl:call-template name="list-terms" />
36                <!--   </ul> -->
37</xsl:template>                 
38
39<xsl:template name="summary-overall">
40                <table>
41                <tbody>
42                        <tr><td>profileDescription</td><td align="right"><xsl:value-of select="count(//profileDescription)"/></td></tr>                 
43                        <tr><td>componentDescription</td><td align="right"><xsl:value-of select="count(//componentDescription)"/></td></tr>                     
44                        <tr><td>CMD_ComponentSpec</td><td align="right"><xsl:value-of select="count(//CMD_ComponentSpec)"/></td></tr>
45                        <tr><td>profiles</td><td align="right"><xsl:value-of select="count(//CMD_ComponentSpec[@isProfile='true'])"/></td></tr>
46                        <tr><td>CMD_Component</td><td align="right"><xsl:value-of select="count(//CMD_Component)"/></td></tr>                   
47                        <tr><td>distinct CMD_Component</td><td align="right"><xsl:value-of select="count(distinct-values(//CMD_Component/@name))"/></td></tr>                   
48                        <tr><td>CMD_Element</td><td align="right"><xsl:value-of select="count(//CMD_Element)"/></td></tr>                                               
49                        <tr><td>distinct CMD_Element</td><td align="right"><xsl:value-of select="count(distinct-values(//CMD_Element/@name))"/></td></tr>                                               
50                        <tr><td>CMD_Elements without ConceptLink</td><td align="right"><xsl:value-of select="count(distinct-values(//CMD_Element[@ConceptLink='' or not(@ConceptLink)]/@name))"/></td></tr>                                             
51                        <tr><td>conceptlinks</td><td align="right"><xsl:value-of select="count(//@ConceptLink)"/></td></tr>                                             
52                        <tr><td>conceptlinks (without lang-codes ISO639)</td><td align="right"><xsl:value-of select="count($concepts_nolang)"/></td></tr>                                               
53                        <tr><td>distinct conceptlinks (without lang-codes)</td><td align="right"><xsl:value-of select="count(distinct-values($concepts_nolang))"/></td></tr>                                           
54                        <tr><td>distinct CMD_Elem-conceptlinks</td><td align="right"><xsl:value-of select="count(distinct-values($concepts_nolang[parent::CMD_Element]))"/></td></tr>                                           
55                        <tr><td>datcats in isocat-profile:Metadata#5</td><td align="right"><xsl:value-of select="count($isocat//dcif:dataCategory)"/></td></tr>                                         
56                       
57                        <tr><td>elem matrix</td><td align="right"><xsl:value-of select="count($term_matrix/Term)"/></td></tr>                                           
58                        <tr><td>distinct profile-elem</td><td align="right"><xsl:value-of select="count(distinct-values($term_matrix/Term/concat(@profile,@elem)))"/></td></tr>
59                        <tr><td>distinct profile-datcat</td><td align="right"><xsl:value-of select="count(distinct-values($term_matrix/Term/concat(@profile,@datcat)))"/></td></tr>
60                        <tr><td>distinct parent-elem</td><td align="right"><xsl:value-of select="count(distinct-values($term_matrix/Term/concat(@parent,@elem)))"/></td></tr>
61                        <tr><td>distinct profile-parent-elem</td><td align="right"><xsl:value-of select="count(distinct-values($term_matrix/Term/concat(@profile,@parent,@elem)))"/></td></tr>
62                       
63                </tbody>
64</table>
65       
66</xsl:template>                 
67
68
69<xsl:template name="summary-profiles">
70       
71        <table>
72                <caption>Profiles |<xsl:value-of select="count(//profileDescription)" />|</caption>
73                <thead><tr><th>name</th><th>|elem|</th><th>|distinct elems|</th><th>|distinct @ConceptLinks|</th></tr></thead>
74                <tbody>         
75                                <xsl:for-each select="//profileDescription" >
76                                        <xsl:sort select="name" order="ascending"/>                                     
77                                                <tr><td><xsl:value-of select="name"/></td>                                                                     
78                                                        <td align="right"><xsl:value-of select="count(.//CMD_Element)"/></td>
79                                                        <td align="right"><xsl:value-of select="count(distinct-values(.//CMD_Element/@name))"/></td>
80                                                        <td align="right"><xsl:value-of select="count(distinct-values(.//CMD_Element/@ConceptLink))"/></td>
81                       
82                                                </tr>
83                                       
84                                </xsl:for-each>
85                </tbody>
86        </table>
87
88</xsl:template>
89       
90<xsl:template name="list-terms">
91       
92        <div id="term-list" >
93                <span class="box_heading" >Elements</span> <span class="note">|<xsl:value-of select="count($term_matrix/Term)" />/<xsl:value-of select="count(distinct-values($term_matrix/Term/@elem))" />|</span>
94               
95                        <ul>
96                                <xsl:for-each-group select="$term_matrix/Term" group-by="lower-case(@elem)">
97                                        <xsl:sort select="lower-case(@elem)" order="ascending"/>                                       
98                                                <li><span class="term_detail_caller" ><a href="{@elem}" ><xsl:value-of select="@elem"/></a></span>
99                                                       
100                                                                        <span class="note" >
101                                                                                |<xsl:value-of select="count(distinct-values(current-group()/@datcat))"/>/
102                                                                                        <xsl:value-of select="count(distinct-values(current-group()/@profile))"/>/
103                                                                                        <xsl:value-of select="count(current-group())"/>|
104                                                                                        <!-- <xsl:value-of select="count(distinct-values(current-group()//node()[not(name()='CMD_Element')]/@ConceptLink))"/> -->
105                                                                        </span>
106                                                                        <span class="cmd cmd_filter"><xsl:text> </xsl:text></span><span class="cmd cmd_detail" ><xsl:text> </xsl:text></span><span class="cmd cmd_columns" ><xsl:text> </xsl:text></span>
107                                                                <div class="term_detail" >
108                                                                        <div class="box_heading"><xsl:value-of select="@elem"/></div>
109                                                                                <ul>
110                                                                                        <xsl:for-each-group select="current-group()" group-by="@datcat">
111                                                                                                <li><xsl:value-of select="my:shortURL(@datcat)"/>
112                                                                                                        <ul>
113                                                                                                                <xsl:for-each-group select="current-group()" group-by="@profile" >
114                                                                                                                        <li><xsl:value-of select="@profile" />
115                                                                                                                                        <ul>
116                                                                                                                                                <xsl:for-each select="current-group()/@comppath" >
117                                                                                                                                                                <li><span class="cmd cmd_filter"><xsl:text> </xsl:text></span> <span class="cmd cmd_detail"><xsl:text> </xsl:text></span> <span class="cmd cmd_columns"><xsl:text> </xsl:text></span>
118                                                                                                                                                                        <a href="{.}" ><xsl:value-of select="." /></a></li>
119                                                                                                                                                </xsl:for-each>
120                                                                                                                                        </ul>
121                                                                                                                        </li>
122                                                                                                                </xsl:for-each-group>
123                                                                                                        </ul>
124                                                                                                </li>                                           
125                                                                                        </xsl:for-each-group>
126                                                                                </ul>
127                                                                </div>                                                 
128                                               
129                                                </li>
130                                </xsl:for-each-group>
131                        </ul>   
132        </div>
133</xsl:template>
134       
135<xsl:template name="list-datcats">
136       
137        <table>
138                <caption>DatCats |<xsl:value-of select="count(distinct-values($term_matrix/Term/@datcat))" />| <span class="note">* Click on numbers to see detail </span></caption>
139                                <thead><tr><th rowspan="2">id</th><th rowspan="2">name</th>
140                                        <th colspan="3" >count </th><th rowspan="2">elems</th></tr>
141                                        <tr><th>profile*</th><th >all*</th><th>elems</th> </tr>         </thead>
142                <tbody>         
143                                <xsl:for-each-group select="$term_matrix/Term" group-by="@datcat">
144                                        <xsl:sort select="lower-case(@datcat)" order="ascending"/>                                     
145                                                <tr><td valign="top"><xsl:value-of select="my:shortURL(@datcat)"/></td>
146                                                <td valign="top"><xsl:value-of select="my:rewriteURL(@datcat)"/></td>
147                                                <td valign="top" align="right">
148                                                        <span class="term_detail_caller" ><xsl:value-of select="count(distinct-values(current-group()/@profile))"/></span>
149                                                        <div class="term_detail" >
150                                                                        <div class="box_heading"><xsl:value-of select="my:rewriteURL(@datcat)"/></div>
151                                                                        <ul>
152                                                                                <xsl:for-each select="distinct-values(current-group()/@profile)" >
153                                                                                        <li><xsl:value-of select="." /></li>
154                                                                                </xsl:for-each>
155                                                                        </ul>
156                                                                </div>                                                 
157                                                </td>
158                                                <td valign="top" align="right">
159                                                        <span class="term_detail_caller" ><xsl:value-of select="count(current-group())"/></span>
160                                                        <div class="term_detail" >
161                                                                        <div class="box_heading"><xsl:value-of select="my:rewriteURL(@datcat)"/></div>
162                                                                        <ul>
163                                                                                <xsl:for-each-group select="current-group()" group-by="@profile" >
164                                                                                        <li><xsl:value-of select="@profile" />
165                                                                                                        <ul>
166                                                                                                                <xsl:for-each select="current-group()/@comppath" >
167                                                                                                                                <li><xsl:value-of select="." /></li>
168                                                                                                                </xsl:for-each>
169                                                                                                        </ul>
170                                                                                        </li>
171                                                                                </xsl:for-each-group>
172                                                                        </ul>
173                                                                </div>                                                 
174                                                </td>
175                                                <td valign="top" align="right"><xsl:value-of select="count(distinct-values(current-group()/@elem))"/></td>                                             
176                                                       
177                                                <td width="40%">                                               
178                                                                <xsl:for-each select="distinct-values(current-group()/@elem)">
179                                                                        <xsl:sort select="." />
180                                                                        <xsl:value-of select="."/>,
181                                                                </xsl:for-each>
182                                                </td>                                                                                           
183                                                </tr>                                   
184                                </xsl:for-each-group>
185                </tbody>
186        </table>
187        </xsl:template>
188
189        <!--
190        obsolete
191<xsl:function name="m:shorturl" >
192        <xsl:param name="url" />
193        <xsl:value-of select="replace($url, 'http://www.isocat.org/datcat/','isocat:')" />     
194</xsl:function>
195
196<xsl:function name="m:resolve" >
197        <xsl:param name="url" />       
198        <xsl:message>1:<xsl:value-of select="$url" /></xsl:message>
199        <xsl:variable name="field" select="'name'" />
200        <xsl:variable name="datcat"  select="$isocat//dcif:dataCategory[@pid=$url]" /> 
201        <xsl:value-of select="$datcat/@name" />
202        <xsl:message><xsl:value-of select="$datcat/@name" /></xsl:message>
203</xsl:function>
204
205<xsl:function name="m:resolve" >
206        <xsl:param name="url" />
207        <xsl:param name="field" />
208        <xsl:message>2:<xsl:value-of select="$url" /></xsl:message>
209        <xsl:variable name="datcat"  select="$isocat//dcif:dataCategory[@pid=$url]" /> 
210        <xsl:value-of select="$datcat/@*[name()=$field]" />
211       
212</xsl:function>
213-->
214
215<xsl:template name="obsolete">
216
217 <!--
218 <style type="text/css">
219                .term_detail { text-align: left; border: 1px solid #666699; background-color: #ccccff; position:absolute; }
220                .term_detail ul { padding-left: 16px; }
221                .hilight { background-color: #ccccff;}
222                .box_heading {font-weight:bold;}
223 </style>
224
225                        <script type="text/javascript">                 
226                                $(function(){
227                                       
228                                        $('.term_detail').hide();
229                                       
230                                        $('.term_detail_caller').click(function() {
231                                                                        $(this).parent().find('.term_detail').toggle();
232                                                                        $(this).parents('tr').toggleClass('hilight');
233                                                                });
234                                });
235                        </script>
236 -->
237</xsl:template>                 
238
239
240</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.