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

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

minor changes (linking, layout) for recordset, record, admin/cache

File size: 5.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>
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/*" />
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" select="ResourceRef">
112                        <!--
113                                <xsl:choose>
114                                        <xsl:when test="contains(ResourceRef,$base_uri)">
115                                                        <xsl:value-of select="substring-after(concat(substring-before(ResourceRef,'.xml'),'.html'),$base_uri)" />
116                                        </xsl:when>
117                                        <xsl:otherwise>
118                                                        <xsl:value-of select="concat(substring-before(ResourceRef,'.xml'),'.html')" />
119                                        </xsl:otherwise>
120                                </xsl:choose>-->                               
121                        </xsl:variable>
122                       
123                <li><span class="label" ><xsl:value-of select="ResourceType" />:</span> <a class="internal" href="{concat($default_prefix, my:encodePID($href))}" ><xsl:value-of select="$href" /></a></li>
124        </xsl:template> 
125
126<xsl:template match="*" >
127        <!-- <xsl:param name="lv" select="1" />-->
128        <!--<xsl:variable name="lv" select="count(ancestor::d)" /> -->
129        <xsl:if test="exists(.//text()) or @*" >
130                <xsl:variable name="has_text" >
131                        <xsl:choose>
132                                <xsl:when test="normalize-space(text()[1])='Unspecified'">unspecified</xsl:when>
133                                <xsl:when test="not(normalize-space(string-join(text(),''))='')">text</xsl:when>                               
134                                <xsl:otherwise>empty</xsl:otherwise>
135                        </xsl:choose>                   
136                </xsl:variable>
137                <div class="cmds-xmlelem value-{$has_text}" >
138                                <span class="label"><xsl:value-of select="name()" />:</span>
139                                <span class="value"><xsl:call-template name="format-value" > 
140                                                                                <xsl:with-param name="value" select="text()[.!='']" />
141                                                                        </xsl:call-template>
142                                </span>
143                        <xsl:apply-templates select="*" />
144                        <xsl:if test="@*">
145                                <div class="attributes">
146                                        <xsl:apply-templates select="@*" />
147                                </div>
148                        </xsl:if>
149                </div> 
150        </xsl:if>
151</xsl:template> 
152
153<xsl:template match="@*" >
154        <span class="label"><xsl:value-of select="name()" />: </span><span class="value"><xsl:call-template name="format-value" /><!--<xsl:value-of select="." /> --></span>;
155</xsl:template> 
156
157
158</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.