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

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

output - method, DOCTYPE, encoding issues (trying to unify for xhtml (but not over all xsls yet); test-suite update

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" select="(//Title|//title|//ResourceName|//Name|//name)" /> 
32                <!--  <xsl:variable name="titles">                                                                       
33                                        <xsl:choose>
34                                        <xsl:when test="exists(//Title/text())">
35                                                        <xsl:copy-of select="//Title" />
36                                        </xsl:when>
37                                        <xsl:when test="exists(//title/text())">
38                                                        <xsl:copy-of select="//title" />
39                                        </xsl:when>
40                                        <xsl:otherwise>
41                                                        <xsl:copy-of select="(//Name|//name)" />
42                                        </xsl:otherwise>
43                                </xsl:choose>
44                </xsl:variable>
45                 -->
46                <!--<xsl:value-of select="count($titles)" /> -->
47                <xsl:value-of select="$titles[1]" />                   
48</xsl:param>
49
50<xsl:template name="continue-root" >
51
52        <div class="mdrecord-detail" >
53                <xsl:choose>
54                        <xsl:when test="contains($format,'htmlpage')">
55                                <h3><xsl:value-of select="$inner_title" /></h3>
56                                <xsl:call-template name="getContext" />
57                        </xsl:when>     
58                        <xsl:otherwise>
59                       
60                        <xsl:call-template name="getContext" />
61                        <!-- <div class="is-part-of collections" ><xsl:value-of select=".//IsPartOf[@level=1]" /> </div> -->
62                        <div class="title" ><xsl:call-template name="getName" /></div>
63                        <!--
64                                <span class="inner_title"><xsl:attribute name="value"><xsl:value-of select="$inner_title"/>
65                                </xsl:attribute>
66                                </span>
67                                -->
68                        </xsl:otherwise>
69                </xsl:choose>           
70         <!--<span class="label">MDRecord View: </span>
71                <div class="title" ><xsl:value-of select="$inner_title"/></div>--> 
72       
73               
74                <xsl:apply-templates select=".//ResourceProxyList" />
75                <xsl:apply-templates select=".//Components/*" mode="format-xmlelem" />
76        </div> 
77</xsl:template> 
78
79       
80<xsl:template match="ResourceProxyList" >
81                <xsl:choose>
82                        <xsl:when test="count(ResourceProxy) &gt; 1"> 
83                                <div class="resource-links">
84                                        <span class="detail-caller">
85                                                <span class="cmd cmd_up" ></span><span class="label" >references </span><xsl:value-of select="count(ResourceProxy[ResourceType='Metadata'])" /> <span class="label" > MDRecords, </span> 
86                                                                        <xsl:value-of select="count(ResourceProxy[ResourceType='Resource'])" /> <span class="label" > Resources</span>
87                                        </span>                                 
88                                        <ul class="detail"> 
89                                                <xsl:if test="count(ResourceProxy) &gt; $resourceref_limit" >
90                                                        <span class="label" >showing first </span> <xsl:value-of select="$resourceref_limit" /> <span class="label" > references. </span> 
91                                                        <s><a href="{concat($default_prefix, my:encodePID(./ancestor::CMD/Header/MdSelfLink))}">see more</a></s>                                                       
92                                                </xsl:if>
93                                                <xsl:apply-templates select="ResourceProxy[position() &lt; $resourceref_limit]" />
94                                        </ul>
95                                </div>
96                        </xsl:when>
97                        <xsl:otherwise>
98                                <ul>
99                                        <xsl:apply-templates />
100                                </ul>                   
101                        </xsl:otherwise>
102                </xsl:choose>
103               
104</xsl:template> 
105       
106        <xsl:template match="ResourceProxy" >
107       
108                        <xsl:variable name="href" >                                             
109                                <xsl:choose>
110                                        <xsl:when test="ResourceType='Resource'">
111                                                        <xsl:value-of select="ResourceRef" />
112                                        </xsl:when>
113                                        <xsl:otherwise>
114                                                        <xsl:value-of select="concat($default_prefix, my:encodePID(ResourceRef))" />
115                                        </xsl:otherwise>
116                                </xsl:choose>                           
117                        </xsl:variable>
118                       
119                        <xsl:variable name="class" select=" if (ResourceType='Resource') then 'external' else 'internal'" />
120                       
121                <li><span class="label" ><xsl:value-of select="ResourceType" />: </span> 
122                                <a class="{$class}" href="{$href}" target="_blank" >
123                                                <xsl:value-of select="ResourceRef" />
124                                </a>
125                </li>
126        </xsl:template> 
127
128</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.