Changeset 765


Ignore:
Timestamp:
10/10/10 12:28:04 (14 years ago)
Author:
vronk
Message:

adding model2matrix.xsl, appropriate changes to model2view.xsl

Location:
MDService2/trunk/MDService2/src/xsl
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/src/xsl/cmd_commons.xsl

    r742 r765  
    4242
    4343<xsl:template name="html">
     44
    4445        <html>
    4546        <head>
    4647        <title><xsl:value-of select="$title"/></title>
    47          <!--  <link rel="stylesheet" media="all" type="text/css" href="{$style_dir}/vronk_style.css"  />                         
    48          <link rel="stylesheet" media="all" type="text/css" href="{$style_dir}/cmdi.css"  />
     48
     49        <link rel="stylesheet" href="{$base_dir}/style/jquery/clarindotblue/jquery-ui-1.8.5.custom.css" type="text/css" />
     50        <link href="{$base_dir}/style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet" />
     51        <link href="{$base_dir}/style/jquery/treetable/jquery.treeTable.css" rel="stylesheet" ></link>
     52        <link href="{$base_dir}/style/cmds-ui.css" type="text/css" rel="stylesheet"></link>
     53       
     54        <link href="{$base_dir}style/jquery/jquery-textboxlist/TextboxList.css" rel="stylesheet" type="text/css"></link>
     55        <link href="{$base_dir}style/jquery/jquery-autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css"></link>
     56
     57        <script src="{$base_dir}/scripts/jquery/js/jquery-1.4.2.js" type="text/javascript"></script>
     58        <script src="{$base_dir}/scripts/jquery/js/jquery-ui-1.8.5.custom.min.js" type="text/javascript"></script>
     59        <script src="{$base_dir}/scripts/jquery/jquery-treeview/jquery.treeview.js" type="text/javascript"></script>
     60        <script src="{$base_dir}/scripts/jquery/jquery-treeTable/jquery.treeTable.js" type="text/javascript"></script>
     61        <!-- <script src="scripts/jquery/jquery-autocomplete/jquery.autocomplete.js" type="text/javascript"></script>
     62       
     63        <script src="scripts/mdservice_searchclause.js" type="text/javascript"></script>
     64        <script src="scripts/mdservice_model.js" type="text/javascript"></script>
     65        <script src="scripts/mdservice2_ui.js" type="text/javascript"></script>
    4966          -->
    50          <link rel="stylesheet" href="{$base_dir}/style/jquery/smoothness/jquery-ui-1.8.1.custom.css" type="text/css" ></link>
    51 <link href="{$base_dir}/style/jquery/jquery-treeview/jquery.treeview.css" rel="stylesheet" ></link>
    52 <link href="{$base_dir}/style/jquery/treetable/jquery.treeTable.css" rel="stylesheet" ></link>
    53 <link href="{$base_dir}/style/metares.css" type="text/css" rel="stylesheet" ></link>
    54 <link href="{$base_dir}/style/cmdi.css" type="text/css" rel="stylesheet" ></link>
    55 <link href="{$base_dir}/style/query.css" type="text/css" rel="stylesheet" ></link>
    56 <!--
    57 <link href="{$base_dir}/style/jquery/jquery-textboxlist/TextboxList.css" rel="stylesheet" type="text/css" />
    58 <link href="{$base_dir}/style/jquery/jquery-autocomplete/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    59 -->
    60 <!-- 
    61 <script src="{$base_dir}/scripts/jquery/js/jquery-1.3.2.min.js" type="text/javascript"></script>-->
    62 <script src="{$base_dir}/scripts/jquery/js/jquery-1.4.2.js" type="text/javascript"></script>
    63 <script src="{$base_dir}/scripts/jquery/js/jquery-ui-1.8.1.custom.min.js" type="text/javascript"></script>
    64 
    65 <!--
    66 <script src="{$base_dir}/scripts/jquery/jquery-textboxlist/GrowingInput.js" type="text/javascript"></script>
    67 
    68 <script src="scripts/jquery/jquery-textboxlist/TextboxList.js" type="text/javascript"></script>
    69 
    70  -->
    71 
    72 <script src="{$base_dir}/scripts/jquery/jquery-treeview/jquery.treeview.js" type="text/javascript"></script>
    73 
    74 <script src="{$base_dir}/scripts/jquery/jquery-treeTable/jquery.treeTable.js" type="text/javascript"></script>
    75 <!-- <script src="scripts/jquery/jquery-autocomplete/jquery.autocomplete.js" type="text/javascript"></script>
    76 
    77 <script src="scripts/mdservice_searchclause.js" type="text/javascript"></script>
    78 <script src="scripts/mdservice_model.js" type="text/javascript"></script>
    79 <script src="scripts/mdservice2_ui.js" type="text/javascript"></script>
    80           -->
     67
    8168        <xsl:call-template name="callback-header"/>
    8269        </head>
     
    141128    <xsl:template match="componentDescription[id] | profileDescription[id]" mode="include">
    142129   
    143         <xsl:variable name="resolved_uri" select="concat($root_uri, '/', id)" />
     130        <!--  <xsl:variable name="resolved_uri" select="concat($root_uri, '/', id)" />-->
     131        <xsl:variable name="resolved_uri" select="concat($cmdprofiles_uri , '/', my:extractID(id))" />
     132       
    144133       
    145134        <xsl:message>resolved_uri:<xsl:value-of select="$resolved_uri" /></xsl:message>
     
    160149               
    161150                <xsl:for-each select="//CMD_Element" >
    162                                         <xsl:variable name="comp_path" select="my:comppath(.)" >
     151                                        <xsl:variable name="context" select="my:context(.)" >
    163152                                                        <!--  <xsl:for-each select="ancestor::CMD_Component" >
    164153                                                                <xsl:value-of select="@name" />.</xsl:for-each>-->
    165154                                        </xsl:variable>
    166155                        <Term  elem="{@name}" datcat="{@ConceptLink}" profile="{ancestor::profileDescription[1]/name}"
    167                                                         parent="{ancestor::CMD_Component[1]/@name}"  comppath="{$comp_path}" >
     156                                                        parent="{ancestor::CMD_Component[1]/@name}"  context="{$context}" >
    168157                                                                <xsl:copy-of select="." />
    169158                        </Term>
     
    171160       
    172161</xsl:variable>
     162
     163
     164<xsl:template match="Term" mode="matrix" >
     165               
     166                <xsl:for-each select=".//Term" >
     167                        <xsl:variable name="context" select="my:context(.)" >
     168                                                        <!--  <xsl:for-each select="ancestor::CMD_Component" >
     169                                                                <xsl:value-of select="@name" />.</xsl:for-each>-->
     170                                        </xsl:variable>
     171                        <Term  elem="{@name}" datcat="{my:term2datcat(@name)}" profile="{ancestor::profileDescription[1]/name}"
     172                                                        parent="{ancestor::Term[1]/@name}"  context="{$context}" >
     173                                                                <xsl:copy-of select="." />
     174                        </Term>
     175                </xsl:for-each>
     176       
     177</xsl:template>
     178
     179
     180<xsl:function name="my:profilematrix" >
     181    <xsl:param name="term"/>
     182   
     183    <xsl:variable name="profile" select="my:profile($term,true())" />
     184    <Terms name="{$profile/name}"  id="{$profile/id}">
     185        <xsl:for-each select="$profile//CMD_Component|$profile//CMD_Element" >
     186                                        <xsl:variable name="context" select="my:context(.)" />                                         
     187                                       
     188                                        <xsl:variable name="id"  >
     189                                                        <xsl:choose>
     190                                                                <xsl:when test="@ComponentId">
     191                                                                        <xsl:value-of select="@ComponentId" />
     192                                                                </xsl:when>
     193                                                                <xsl:otherwise>
     194                                                                        <xsl:value-of select="ancestor::CMD_Component[@ComponentId][1]/@ComponentId" /><xsl:text>#</xsl:text>
     195                                                                        <xsl:for-each select="ancestor::CMD_Component[not(descendant-or-self::CMD_Component[@ComponentId])]" >
     196                                                                        <xsl:value-of select="@name" />.</xsl:for-each><xsl:value-of select="@name" />
     197                                                                </xsl:otherwise>
     198                                                        </xsl:choose>                                                   
     199                                        </xsl:variable>
     200                        <Term  name="{@name}" datcat="{@ConceptLink}" id="{$id}"
     201                                                        parent="{ancestor::CMD_Component[1]/@name}" context="{$context}"
     202                                                        >
     203                                                                <!--  <xsl:copy-of select="." /> -->
     204                        </Term>
     205                </xsl:for-each>
     206        </Terms>
     207   
     208</xsl:function>
     209
     210<xsl:function name="my:profile" >
     211    <xsl:param name="term"/>
     212    <xsl:param name="resolve" /> <!--  true|false-->
     213   
     214    <xsl:message>cmdprofiles_uri: <xsl:value-of select="$cmdprofiles_uri" /></xsl:message>
     215   
     216    <xsl:variable name="profile" select="doc($cmdprofiles_uri)//profileDescription[name=$term]" />
     217   
     218    <xsl:choose>
     219      <xsl:when test="$resolve=true()">
     220                <xsl:apply-templates select="$profile" mode="include" />
     221      </xsl:when>
     222      <xsl:otherwise>
     223                <xsl:copy-of select="$profile" />
     224      </xsl:otherwise>
     225    </xsl:choose>
     226   
     227       
     228</xsl:function>
     229
     230        <xsl:function name="my:term2datcat">
     231     <xsl:param name="term"/>                             
     232     <xsl:value-of select="$term_matrix/*[@elem=$term]/@datcat" />                                     
     233   </xsl:function>
    173234
    174235
     
    202263                        </xsl:when>
    203264                        <xsl:when test="contains($uri,$components_id_prefix)">
    204                         <!--   <xsl:value-of select="substring-after($uri,'clarin.eu:cr1:')" /> -->
     265                        <!--   <xsl:value-of select="substring-after($uri,$components_id_prefix)" /> -->
    205266                                <xsl:value-of select="substring-after($uri, $components_id_prefix)" />
    206267                        </xsl:when>
     
    228289        </xsl:function>
    229290               
    230         <xsl:function name="my:comppath" >
     291        <xsl:function name="my:context" >
    231292                <xsl:param name="child" />
    232         <xsl:for-each select="$child/ancestor::CMD_Component" >
    233                         <xsl:value-of select="@name" />.</xsl:for-each><xsl:value-of select="$child/@name" />   
     293                <xsl:variable name="collect" >
     294                                <xsl:for-each select="$child/ancestor::CMD_Component|$child/ancestor::Term" >
     295                                                <xsl:value-of select="@name" />.</xsl:for-each><xsl:value-of select="$child/@name" />
     296                </xsl:variable>
     297                <xsl:value-of select="$collect" />     
    234298        </xsl:function>
    235299   
  • MDService2/trunk/MDService2/src/xsl/complist2terms.xsl

    r692 r765  
    3030
    3131
    32 <xsl:variable name="term_matrix" >
    33                
    34                 <xsl:for-each select="//CMD_Element" >
    35                                         <xsl:variable name="comp_path" select="my:comppath(.)" >
    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                        
    4732
    4833<xsl:template name="continue-root">
  • MDService2/trunk/MDService2/src/xsl/mdinst2view.xsl

    r699 r765  
    8989                        </xsl:choose>                   
    9090                </xsl:variable>
    91                 <div class="elem {$has_text}" ><span class="elem_name"><xsl:value-of select="name()" />:</span>
    92                 <span class="elem_value"><xsl:value-of select="text()" /></span>
     91                <div class="cmds-xmlelem value-{$has_text}" ><span class="label"><xsl:value-of select="name()" />:</span>
     92                <span class="value"><xsl:value-of select="text()" /></span>
    9393                        <xsl:apply-templates select="*" />
    9494                        <xsl:if test="@*">
     
    102102
    103103<xsl:template match="@*" >
    104         <span class="attr_name"><xsl:value-of select="name()" />: </span><span class="value"><xsl:value-of select="." /></span>;
     104        <span class="label"><xsl:value-of select="name()" />: </span><span class="value"><xsl:value-of select="." /></span>;
    105105</xsl:template>
    106106
  • MDService2/trunk/MDService2/src/xsl/model2view.xsl

    r699 r765  
    44  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    55  xmlns:xs="http://www.w3.org/2001/XMLSchema"
    6   xmlns:m="http://www.vronk.net/schemas"
     6    xmlns:my="myFunctions"
    77>
    88<!--
     
    1717-->
    1818<xsl:import href="cmd_commons.xsl"/>
     19<xsl:import href="model2matrix.xsl"/>
    1920
    2021
     
    3233<xsl:param name="detail_uri_prefix"  select="'?q='"/>
    3334-->
    34 <!--   <xsl:output method="html" />  -->
     35<xsl:output method="html" />
    3536
    3637
     
    3839
    3940<xsl:template name="continue-root">
     41
     42                <xsl:variable name="termmatrix">
     43                        <xsl:apply-templates mode="matrix" />
     44                </xsl:variable>
     45               
     46                <xsl:for-each select="$termmatrix" >
     47                        <xsl:call-template name="continue" />
     48                </xsl:for-each>
     49
     50</xsl:template>
     51
     52<xsl:template name="continue">
    4053        <div>   
    4154                <xsl:choose>                   
    4255                 <xsl:when test="$format='model2htmltable'" >
    4356                        <xsl:call-template name="header"/>   
    44                         <xsl:call-template name="table"/>   
     57                        <xsl:call-template name="table"/>
     58                           
    4559                </xsl:when>
    4660                <xsl:when test="$format='model2htmlpage'" >
    4761                        <xsl:call-template name="header"/>
    4862                            <div id="model">
    49                                         <table id="modeltree" >
     63                                <xsl:call-template name="terms-tree" />
     64                                <xsl:call-template name="list-datcats" />
     65                                        <!-- <table id="modeltree" >
    5066                                                <thead>
    51                                                 <tr><th class="treecol">Name</th><th>Count Elems</th><th>Count Text</th><th>Count Distinct Text</th><th>Path</th></tr>
     67                                                <tr><th class="treecol">Name</th><th>Count Elems</th><th>Count Text</th><th>Count Distinct Text</th><th>Path</th><th>comp/datcat</th></tr>
    5268                                                </thead>                                       
    5369                                                <xsl:apply-templates select="*/Term" mode="detail">
    5470                                                        <xsl:sort order="ascending" select="@n" />                                                     
    5571                                                </xsl:apply-templates>
    56                                         </table>
    57                                 </div>                                                         
     72                                        </table>  -->
     73                                </div>           
     74                                                                               
    5875                        </xsl:when>                             
    5976                <xsl:when test="$format='model2htmllist'" >                     
     
    6279                <xsl:when test="$format='model2htmlselect'" >                                                         
    6380                                        <select id="terms-select">             
    64                                                         <xsl:apply-templates select="/*/*/Term" mode="select"/>                                                 
     81                                                        <xsl:apply-templates select="./*/*/Term" mode="select"/>                                                       
    6582                                                </select>                                                               
    6683                        </xsl:when>
     
    119136
    120137<xsl:template match="Term" mode="list" >
    121                 <xsl:variable name="translated_path" select="translate(replace(@path,'//',''),'/','.')" />
    122                                 <li><span class="term_detail_caller"><a href="{concat($detail_model_prefix,$translated_path)}" >
     138                <!--  <xsl:variable name="translated_path" select="translate(replace(@path,'//',''),'/','.')" /> -->
     139                                <li><div class="cmds-elem-plus"><span class="detail-caller"><a href="{concat($detail_model_prefix,@context)}" >
    123140                                        <xsl:value-of select="@name"/></a></span>
    124141                                        <span class="note">|<xsl:value-of select="@count"/>/<xsl:value-of select="@count_text"/>/<xsl:value-of select="@count_distinct_text"/>|</span>                                 
    125                                         <span class="data comppath"><xsl:value-of select="$translated_path" /></span>           
     142                                        <span class="data comppath"><xsl:value-of select="@path" /></span>               
    126143                                        <span class="cmd cmd_filter"><xsl:text> </xsl:text></span>
    127144                                        <span class="cmd cmd_detail" ><xsl:text> </xsl:text></span>
    128145                                        <span class="cmd cmd_columns" ><xsl:text> </xsl:text></span>
    129                                        
     146                                                <div class="detail">
     147                                                        <xsl:for-each select="@*" >
     148                                                                <div class="cmds-elem-prop"><span class="label"><xsl:value-of select="name()" />: </span>
     149                                                                        <span class="value"><xsl:value-of select="." /></span></div>
     150                                                        </xsl:for-each>
     151                                                </div>
     152                                        </div>
    130153                                        <ul><xsl:apply-templates select="*" mode="list" /></ul>                         
    131154                                </li>                   
    132155</xsl:template>
     156
     157
     158<xsl:template name="terms-tree" >
     159                                        <table id="modeltree" >
     160                                                <thead>
     161                                                <tr><th class="treecol">Name</th><th>Count Elems</th><th>Count Text</th><th>Count Distinct Text</th><th>Path</th><th>comp/datcat</th></tr>
     162                                                </thead>                                       
     163                                                <xsl:apply-templates select="*/Term" mode="detail">
     164                                                        <xsl:sort order="ascending" select="@n" />                                                     
     165                                                </xsl:apply-templates>
     166                                        </table>
     167</xsl:template>                                 
    133168
    134169<xsl:template match="Term" mode="detail" >
     
    152187                <td class="number"><xsl:value-of select="@count_text" /></td>
    153188                <td class="number"><xsl:value-of select="@count_distinct_text" /></td>
    154                 <td><xsl:value-of select="@path" /></td>                       
     189                <td><xsl:value-of select="@path" />,<xsl:value-of select="@context" /></td>                     
     190                <td><xsl:value-of select="@corresponding_component" />,<xsl:value-of select="@datcat" /></td>
    155191     </tr>
    156192                <xsl:if test="Term and ($lv&lt;$max_depth or $max_depth=0)">
     
    186222        <option value="{@name}" ><xsl:value-of select="for $i in (2 to $lv) return ' '" /><xsl:value-of select="@name" /> |<xsl:value-of select="@count" />|</option>
    187223                <xsl:apply-templates select="Term" mode="select" />                     
     224</xsl:template>
     225
     226<!--
     227<xsl:template name="list-datcats" >
     228                                        <table id="datcats" >
     229                                                <thead>
     230                                                <tr><th class="treecol">Name</th><th>Count Elems</th><th>Count Text</th><th>Count Distinct Text</th><th>Path</th><th>comp/datcat</th></tr>
     231                                                </thead>                                       
     232                                                <xsl:apply-templates select="*/Term" mode="detail">
     233                                                        <xsl:sort order="ascending" select="@n" />                                                     
     234                                                </xsl:apply-templates>
     235                                        </table>
     236</xsl:template>                                 
     237 -->
     238<xsl:template name="list-datcats">
     239        <xsl:param name="matrix" select="."></xsl:param>
     240        <table>
     241                <caption>DatCats |<xsl:value-of select="count(distinct-values($matrix//Term/@datcat))" />| <span class="note">* Click on numbers to see detail </span></caption>
     242                                <thead><tr><th rowspan="2">id</th><th rowspan="2">name</th>
     243                                        <th colspan="3" >count </th><th rowspan="2">elems</th></tr>
     244                                        <tr><th>profile*</th><th >all*</th><th>elems</th> </tr>         </thead>
     245                <tbody>         
     246                                <xsl:for-each-group select="$matrix//Term" group-by="@datcat">
     247                                        <xsl:sort select="lower-case(@datcat)" order="ascending"/>                                     
     248                                                <tr><td valign="top"><xsl:value-of select="my:shortURL(@datcat)"/></td>
     249                                                <td valign="top"><xsl:value-of select="my:rewriteURL(@datcat)"/></td>
     250                                                <td valign="top" align="right">
     251                                                        <span class="detail-caller" ><xsl:value-of select="count(distinct-values(current-group()/@name))"/></span>
     252                                                        <div class="detail" >
     253                                                                        <div class="box_heading"><xsl:value-of select="my:rewriteURL(@datcat)"/></div>
     254                                                                        <ul>
     255                                                                                <xsl:for-each select="distinct-values(current-group()/@name)" >
     256                                                                                        <li><xsl:value-of select="." /></li>
     257                                                                                </xsl:for-each>
     258                                                                        </ul>
     259                                                                </div>                                                 
     260                                                </td>
     261                                                <td valign="top" align="right">
     262                                                        <span class="term_detail_caller" ><xsl:value-of select="count(current-group())"/></span>
     263                                                        <div class="term_detail" >
     264                                                                        <div class="box_heading"><xsl:value-of select="my:rewriteURL(@datcat)"/></div>
     265                                                                        <ul>
     266                                                                                <xsl:for-each-group select="current-group()" group-by="@name" >
     267                                                                                        <li><xsl:value-of select="@name" />
     268                                                                                                        <ul>
     269                                                                                                                <xsl:for-each select="current-group()/@context" >
     270                                                                                                                                <li><xsl:value-of select="." /></li>
     271                                                                                                                </xsl:for-each>
     272                                                                                                        </ul>
     273                                                                                        </li>
     274                                                                                </xsl:for-each-group>
     275                                                                        </ul>
     276                                                                </div>                                                 
     277                                                </td>
     278                                                <td valign="top" align="right"><xsl:value-of select="count(distinct-values(current-group()/@elem))"/></td>                                             
     279                                                       
     280                                                <td width="40%">                                               
     281                                                                <xsl:for-each select="distinct-values(current-group()/@elem)">
     282                                                                        <xsl:sort select="." />
     283                                                                        <xsl:value-of select="."/>,
     284                                                                </xsl:for-each>
     285                                                </td>                                                                                           
     286                                                </tr>                                   
     287                                </xsl:for-each-group>
     288                </tbody>
     289        </table>
    188290        </xsl:template>
     291
     292
     293
     294
    189295
    190296<xsl:template name="callback-header" >
     
    196302                table thead {background: #ccccff; font-size:0.9em; }
    197303                table thead tr th { border:1px solid #9999aa; font-weight:normal; text-align:left; padding: 1px 4px;}
    198 
     304
    199305        </style>
    200306        <script type="text/javascript" >
  • MDService2/trunk/MDService2/src/xsl/params.xsl

    r742 r765  
    44       
    55       
     6<!--    <xsl:param name="title" select="'Default Title'" />  -->
    67        <xsl:param name="format"  select="'htmlpag'"/> <!-- table|list -->
    78        <xsl:param name="display_values_limit" select="10" />
     
    1920                the absolute-URL is not nice, however I wasn't able to tell XSL how to resolve a relative url
    2021        -->     
     22        <xsl:param name="cmdprofiles_uri" select="'http://localhost:8080/MDService2/compprofile/xml/'" />
    2123        <xsl:param name="components_uri" select="'http://localhost:8080/MDService2/comp/xml/'" />               
    2224        <xsl:param name="components_id_prefix" select="'clarin.eu:cr1:'" />
Note: See TracChangeset for help on using the changeset viewer.