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

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

adding complist resolution + terms extraction + testdata for that: profiles.xml (to start with)

File size: 10.5 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<xsl:variable name="term_matrix" >
33               
34                <xsl:for-each select="//CMD_Element" >
35                                        <xsl:variable name="comp_path" >
36                                                        <xsl:for-each select="ancestor::CMD_Component" >
37                                                                <xsl:value-of select="@name" />/</xsl:for-each>
38                                        </xsl:variable>
39                        <Term  elem="{@name}" datcat="{@ConceptLink}" profile="{ancestor::profileDescription[1]/name}" 
40                                                        parent="{ancestor::CMD_Component[1]/@name}"  comppath="{$comp_path}" >
41                                                                <xsl:copy-of select="." />
42                        </Term>
43                </xsl:for-each>
44       
45</xsl:variable>
46                       
47
48<xsl:template name="continue-root">
49                <xsl:call-template name="list-terms" />
50</xsl:template>                 
51
52<xsl:template name="summary-overall">
53                <table>
54                <tbody>
55                        <tr><td>profileDescription</td><td align="right"><xsl:value-of select="count(//profileDescription)"/></td></tr>                 
56                        <tr><td>componentDescription</td><td align="right"><xsl:value-of select="count(//componentDescription)"/></td></tr>                     
57                        <tr><td>CMD_ComponentSpec</td><td align="right"><xsl:value-of select="count(//CMD_ComponentSpec)"/></td></tr>
58                        <tr><td>profiles</td><td align="right"><xsl:value-of select="count(//CMD_ComponentSpec[@isProfile='true'])"/></td></tr>
59                        <tr><td>CMD_Component</td><td align="right"><xsl:value-of select="count(//CMD_Component)"/></td></tr>                   
60                        <tr><td>distinct CMD_Component</td><td align="right"><xsl:value-of select="count(distinct-values(//CMD_Component/@name))"/></td></tr>                   
61                        <tr><td>CMD_Element</td><td align="right"><xsl:value-of select="count(//CMD_Element)"/></td></tr>                                               
62                        <tr><td>distinct CMD_Element</td><td align="right"><xsl:value-of select="count(distinct-values(//CMD_Element/@name))"/></td></tr>                                               
63                        <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>                                             
64                        <tr><td>conceptlinks</td><td align="right"><xsl:value-of select="count(//@ConceptLink)"/></td></tr>                                             
65                        <tr><td>conceptlinks (without lang-codes ISO639)</td><td align="right"><xsl:value-of select="count($concepts_nolang)"/></td></tr>                                               
66                        <tr><td>distinct conceptlinks (without lang-codes)</td><td align="right"><xsl:value-of select="count(distinct-values($concepts_nolang))"/></td></tr>                                           
67                        <tr><td>distinct CMD_Elem-conceptlinks</td><td align="right"><xsl:value-of select="count(distinct-values($concepts_nolang[parent::CMD_Element]))"/></td></tr>                                           
68                        <tr><td>datcats in isocat-profile:Metadata#5</td><td align="right"><xsl:value-of select="count($isocat//dcif:dataCategory)"/></td></tr>                                         
69                       
70                        <tr><td>elem matrix</td><td align="right"><xsl:value-of select="count($term_matrix/Term)"/></td></tr>                                           
71                        <tr><td>distinct profile-elem</td><td align="right"><xsl:value-of select="count(distinct-values($term_matrix/Term/concat(@profile,@elem)))"/></td></tr>
72                        <tr><td>distinct profile-datcat</td><td align="right"><xsl:value-of select="count(distinct-values($term_matrix/Term/concat(@profile,@datcat)))"/></td></tr>
73                        <tr><td>distinct parent-elem</td><td align="right"><xsl:value-of select="count(distinct-values($term_matrix/Term/concat(@parent,@elem)))"/></td></tr>
74                        <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>
75                       
76                </tbody>
77</table>
78       
79</xsl:template>                 
80
81
82<xsl:template name="summary-profiles">
83       
84        <table>
85                <caption>Profiles |<xsl:value-of select="count(//profileDescription)" />|</caption>
86                <thead><tr><th>name</th><th>|elem|</th><th>|distinct elems|</th><th>|distinct @ConceptLinks|</th></tr></thead>
87                <tbody>         
88                                <xsl:for-each select="//profileDescription" >
89                                        <xsl:sort select="name" order="ascending"/>                                     
90                                                <tr><td><xsl:value-of select="name"/></td>                                                                     
91                                                        <td align="right"><xsl:value-of select="count(.//CMD_Element)"/></td>
92                                                        <td align="right"><xsl:value-of select="count(distinct-values(.//CMD_Element/@name))"/></td>
93                                                        <td align="right"><xsl:value-of select="count(distinct-values(.//CMD_Element/@ConceptLink))"/></td>
94                       
95                                                </tr>
96                                       
97                                </xsl:for-each>
98                </tbody>
99        </table>
100
101</xsl:template>
102       
103<xsl:template name="list-terms">
104       
105        <div id="term-list" >
106                <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>
107               
108                        <ul>
109                                <xsl:for-each-group select="$term_matrix/Term" group-by="lower-case(@elem)">
110                                        <xsl:sort select="lower-case(@elem)" order="ascending"/>                                       
111                                                <li><span class="term_detail_caller" ><a href="{@elem}" ><xsl:value-of select="@elem"/></a></span>
112                                                                        <span class="note" >
113                                                                                |<xsl:value-of select="count(distinct-values(current-group()/@datcat))"/>/
114                                                                                        <xsl:value-of select="count(distinct-values(current-group()/@profile))"/>/
115                                                                                        <xsl:value-of select="count(current-group())"/>|
116                                                                                        <!-- <xsl:value-of select="count(distinct-values(current-group()//node()[not(name()='CMD_Element')]/@ConceptLink))"/> -->
117                                                                        </span>
118                                                                <div class="term_detail" >
119                                                                        <div class="box_heading"><xsl:value-of select="@elem"/></div>
120                                                                                <ul>
121                                                                                        <xsl:for-each-group select="current-group()" group-by="@datcat">
122                                                                                                <li><xsl:value-of select="my:shortURL(@datcat)"/>
123                                                                                                        <ul>
124                                                                                                                <xsl:for-each-group select="current-group()" group-by="@profile" >
125                                                                                                                        <li><xsl:value-of select="@profile" />
126                                                                                                                                        <ul>
127                                                                                                                                                <xsl:for-each select="current-group()/@comppath" >
128                                                                                                                                                                <li><xsl:value-of select="." /></li>
129                                                                                                                                                </xsl:for-each>
130                                                                                                                                        </ul>
131                                                                                                                        </li>
132                                                                                                                </xsl:for-each-group>
133                                                                                                        </ul>
134                                                                                                </li>                                           
135                                                                                        </xsl:for-each-group>
136                                                                                </ul>
137                                                                </div>                                                 
138                                               
139                                                </li>
140                                </xsl:for-each-group>
141                        </ul>   
142        </div>
143</xsl:template>
144       
145<xsl:template name="list-datcats">
146       
147        <table>
148                <caption>DatCats |<xsl:value-of select="count(distinct-values($term_matrix/Term/@datcat))" />| <span class="note">* Click on numbers to see detail </span></caption>
149                                <thead><tr><th rowspan="2">id</th><th rowspan="2">name</th>
150                                        <th colspan="3" >count </th><th rowspan="2">elems</th></tr>
151                                        <tr><th>profile*</th><th >all*</th><th>elems</th> </tr>         </thead>
152                <tbody>         
153                                <xsl:for-each-group select="$term_matrix/Term" group-by="@datcat">
154                                        <xsl:sort select="lower-case(@datcat)" order="ascending"/>                                     
155                                                <tr><td valign="top"><xsl:value-of select="my:shortURL(@datcat)"/></td>
156                                                <td valign="top"><xsl:value-of select="my:rewriteURL(@datcat)"/></td>
157                                                <td valign="top" align="right">
158                                                        <span class="term_detail_caller" ><xsl:value-of select="count(distinct-values(current-group()/@profile))"/></span>
159                                                        <div class="term_detail" >
160                                                                        <div class="box_heading"><xsl:value-of select="my:rewriteURL(@datcat)"/></div>
161                                                                        <ul>
162                                                                                <xsl:for-each select="distinct-values(current-group()/@profile)" >
163                                                                                        <li><xsl:value-of select="." /></li>
164                                                                                </xsl:for-each>
165                                                                        </ul>
166                                                                </div>                                                 
167                                                </td>
168                                                <td valign="top" align="right">
169                                                        <span class="term_detail_caller" ><xsl:value-of select="count(current-group())"/></span>
170                                                        <div class="term_detail" >
171                                                                        <div class="box_heading"><xsl:value-of select="my:rewriteURL(@datcat)"/></div>
172                                                                        <ul>
173                                                                                <xsl:for-each-group select="current-group()" group-by="@profile" >
174                                                                                        <li><xsl:value-of select="@profile" />
175                                                                                                        <ul>
176                                                                                                                <xsl:for-each select="current-group()/@comppath" >
177                                                                                                                                <li><xsl:value-of select="." /></li>
178                                                                                                                </xsl:for-each>
179                                                                                                        </ul>
180                                                                                        </li>
181                                                                                </xsl:for-each-group>
182                                                                        </ul>
183                                                                </div>                                                 
184                                                </td>
185                                                <td valign="top" align="right"><xsl:value-of select="count(distinct-values(current-group()/@elem))"/></td>                                             
186                                                       
187                                                <td width="40%">                                               
188                                                                <xsl:for-each select="distinct-values(current-group()/@elem)">
189                                                                        <xsl:sort select="." />
190                                                                        <xsl:value-of select="."/>,
191                                                                </xsl:for-each>
192                                                </td>                                                                                           
193                                                </tr>                                   
194                                </xsl:for-each-group>
195                </tbody>
196        </table>
197        </xsl:template>
198
199        <!--
200        obsolete
201<xsl:function name="m:shorturl" >
202        <xsl:param name="url" />
203        <xsl:value-of select="replace($url, 'http://www.isocat.org/datcat/','isocat:')" />     
204</xsl:function>
205
206<xsl:function name="m:resolve" >
207        <xsl:param name="url" />       
208        <xsl:message>1:<xsl:value-of select="$url" /></xsl:message>
209        <xsl:variable name="field" select="'name'" />
210        <xsl:variable name="datcat"  select="$isocat//dcif:dataCategory[@pid=$url]" /> 
211        <xsl:value-of select="$datcat/@name" />
212        <xsl:message><xsl:value-of select="$datcat/@name" /></xsl:message>
213</xsl:function>
214
215<xsl:function name="m:resolve" >
216        <xsl:param name="url" />
217        <xsl:param name="field" />
218        <xsl:message>2:<xsl:value-of select="$url" /></xsl:message>
219        <xsl:variable name="datcat"  select="$isocat//dcif:dataCategory[@pid=$url]" /> 
220        <xsl:value-of select="$datcat/@*[name()=$field]" />
221       
222</xsl:function>
223-->
224
225<xsl:template name="obsolete">
226
227 <!--
228 <style type="text/css">
229                .term_detail { text-align: left; border: 1px solid #666699; background-color: #ccccff; position:absolute; }
230                .term_detail ul { padding-left: 16px; }
231                .hilight { background-color: #ccccff;}
232                .box_heading {font-weight:bold;}
233 </style>
234
235                        <script type="text/javascript">                 
236                                $(function(){
237                                       
238                                        $('.term_detail').hide();
239                                       
240                                        $('.term_detail_caller').click(function() {
241                                                                        $(this).parent().find('.term_detail').toggle();
242                                                                        $(this).parents('tr').toggleClass('hilight');
243                                                                });
244                                });
245                        </script>
246 -->
247</xsl:template>                 
248
249
250</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.