source: MDService2/trunk/MDService2/src/xsl/mdinst2view.xsl @ 1064

Last change on this file since 1064 was 1064, checked in by vronk, 13 years ago

rework recordset-view, display columns-selection (based on result-summary)

File size: 4.3 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>
8<!--
9<purpose> generate a generic html view of a CMDI-instance.</purpose>
10<params>
11<param name=""></param>
12</params>
13<history>
14        <change on="2009-12-31" type="created" by="vr">from cmd2view.xsl (no adaptation yet)</change>   
15        <change on="2010-03-20" type="changed" by="vr">only started to rework</change> 
16        <change on="2010-03-26" type="changed" by="vr">include cmd_commons.xsl</change>
17        <change on="2010-07-11" type="changed" by="vr">integrate into MDService</change>
18</history>
19-->
20   
21<xsl:output method="html" />
22
23<xsl:include href="cmd_commons.xsl"/>
24
25<xsl:param name="base_uri" select="'file:///C:/Users/master/3lingua/clarin/CMDI/data/C4_cmds/'" />   
26
27<!--   <xsl:param name="mode" select="'htmldiv'" /> -->
28<xsl:param name="title" />
29<xsl:param name="inner_title" >
30<!-- Gather just first title/name or something --> 
31                <xsl:variable name="titles">                                                                     
32                                        <xsl:choose>
33                                        <xsl:when test="exists(//Title/text())">
34                                                        <xsl:copy-of select="//Title" />
35                                        </xsl:when>
36                                        <xsl:when test="exists(//title/text())">
37                                                        <xsl:copy-of select="//title" />
38                                        </xsl:when>
39                                        <xsl:otherwise>
40                                                        <xsl:copy-of select="(//Name|//name)" />
41                                        </xsl:otherwise>
42                                </xsl:choose>
43                </xsl:variable>
44                <!--<xsl:value-of select="count($titles)" /> -->
45                <xsl:value-of select="$titles/*[1]" />                 
46</xsl:param>
47
48<xsl:template name="continue-root" >
49
50        <div class="mdrecord-detail" >
51                <xsl:choose>
52                        <xsl:when test="contains($format,'htmlpage')">
53                                <h3><xsl:value-of select="$inner_title" /></h3>
54                        </xsl:when>     
55                        <xsl:otherwise>
56                                <span class="inner_title"><xsl:attribute name="value"><xsl:value-of select="$inner_title"/></xsl:attribute>
57                                </span>
58                        </xsl:otherwise>
59                </xsl:choose>
60               
61         <!--
62         <span class="label">MDRecord View: </span>
63                <div class="box_heading hilight"><xsl:value-of select="$inner_title"/></div>
64          -->
65       
66                <xsl:apply-templates select=".//IsPartOfList" />
67                <xsl:apply-templates select=".//ResourceProxyList" />
68                <xsl:apply-templates select=".//Components/*" mode="format-xmlelem" />
69        </div> 
70</xsl:template> 
71       
72<xsl:template match="IsPartOfList" >
73        <div class="ispartof-list"><span class="label">IsPartOf:</span>
74                <xsl:apply-templates select=".//IsPartOf" />
75        </div>
76</xsl:template> 
77
78<xsl:template match="IsPartOf" >
79        <a class="internal" href="{concat($default_prefix, my:encodePID(.))}"><xsl:value-of select="." /></a>,
80</xsl:template> 
81
82       
83<xsl:template match="ResourceProxyList" >
84                <xsl:choose>
85                        <xsl:when test="count(ResourceProxy) &gt; 1"> 
86                                <div class="resource-links">
87                                        <span class="detail-caller">
88                                                <span class="cmd cmd_up" ></span><span class="label" >references </span><xsl:value-of select="count(ResourceProxy[ResourceType='Metadata'])" /> <span class="label" > MDRecords, </span> 
89                                                                        <xsl:value-of select="count(ResourceProxy[ResourceType='Resource'])" /> <span class="label" > Resources</span>
90                                        </span>                                 
91                                        <ul class="detail"> 
92                                                <xsl:if test="count(ResourceProxy) &gt; $resourceref_limit" >
93                                                        <span class="label" >showing first </span> <xsl:value-of select="$resourceref_limit" /> <span class="label" > references. </span> 
94                                                        <s><a href="{concat($default_prefix, my:encodePID(./ancestor::CMD/Header/MdSelfLink))}">see more</a></s>                                                       
95                                                </xsl:if>
96                                                <xsl:apply-templates select="ResourceProxy[position() &lt; $resourceref_limit]" />
97                                        </ul>
98                                </div>
99                        </xsl:when>
100                        <xsl:otherwise>
101                                <ul>
102                                        <xsl:apply-templates />
103                                </ul>                   
104                        </xsl:otherwise>
105                </xsl:choose>
106               
107</xsl:template> 
108       
109        <xsl:template match="ResourceProxy" >
110       
111                        <xsl:variable name="href" >                                             
112                                <xsl:choose>
113                                        <xsl:when test="ResourceType='Resource'">
114                                                        <xsl:value-of select="ResourceRef" />
115                                        </xsl:when>
116                                        <xsl:otherwise>
117                                                        <xsl:value-of select="concat($default_prefix, my:encodePID(ResourceRef))" />
118                                        </xsl:otherwise>
119                                </xsl:choose>                           
120                        </xsl:variable>
121                       
122                        <xsl:variable name="class" select=" if (ResourceType='Resource') then 'external' else 'internal'" />
123                       
124                <li><span class="label" ><xsl:value-of select="ResourceType" />: </span> 
125                                <a class="{$class}" href="{$href}" target="_blank" >
126                                                <xsl:value-of select="ResourceRef" />
127                                </a>
128                </li>
129        </xsl:template> 
130
131</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.