source: MDService2/branches/MDService_simple3/src/xsl/mdinst2view.xsl @ 1613

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

various small changes, clean up code

File size: 4.7 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<!--  method="xhtml" is saxon-specific! prevents  collapsing empty <script> tags, that makes browsers choke -->
22<xsl:output method="xhtml" media-type="application/xhtml+xml" indent="yes" encoding="UTF-8" 
23doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" /> 
24
25
26<xsl:include href="cmd_commons.xsl"/>
27
28<xsl:param name="base_uri" select="'file:///C:/Users/master/3lingua/clarin/CMDI/data/C4_cmds/'" />   
29
30<!--   <xsl:param name="mode" select="'htmldiv'" /> -->
31<xsl:param name="title" />
32<xsl:param name="inner_title" >
33<!-- Gather just first title/name or something -->     
34        <xsl:variable name="titles" select="(//Title|//title|//ResourceName|//Name|//name)" /> 
35                <!--  <xsl:variable name="titles">                                                                       
36                                        <xsl:choose>
37                                        <xsl:when test="exists(//Title/text())">
38                                                        <xsl:copy-of select="//Title" />
39                                        </xsl:when>
40                                        <xsl:when test="exists(//title/text())">
41                                                        <xsl:copy-of select="//title" />
42                                        </xsl:when>
43                                        <xsl:otherwise>
44                                                        <xsl:copy-of select="(//Name|//name)" />
45                                        </xsl:otherwise>
46                                </xsl:choose>
47                </xsl:variable>
48                 -->
49                <!--<xsl:value-of select="count($titles)" /> -->
50                <xsl:value-of select="$titles[1]" />                   
51</xsl:param>
52
53<xsl:template name="continue-root" >
54
55        <div class="mdrecord-detail" >
56                <xsl:choose>
57                        <xsl:when test="contains($format,'htmlpage')">
58                                <h3><xsl:value-of select="$inner_title" /></h3>
59                                <xsl:call-template name="getContext" />
60                        </xsl:when>     
61                        <xsl:otherwise>
62                       
63                        <xsl:call-template name="getContext" />
64                        <!-- <div class="is-part-of collections" ><xsl:value-of select=".//IsPartOf[@level=1]" /> </div> -->
65                        <div class="title" ><xsl:call-template name="getName" /></div>
66                        <!--
67                                <span class="inner_title"><xsl:attribute name="value"><xsl:value-of select="$inner_title"/>
68                                </xsl:attribute>
69                                </span>
70                                -->
71                        </xsl:otherwise>
72                </xsl:choose>           
73         <!--<span class="label">MDRecord View: </span>
74                <div class="title" ><xsl:value-of select="$inner_title"/></div>--> 
75       
76               
77                <xsl:apply-templates select=".//ResourceProxyList" />
78                <xsl:apply-templates select=".//Components/*" mode="format-xmlelem" />
79        </div> 
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                                                        <s><a href="{my:formURL('record', 'htmlpage', my:encodePID(./ancestor::CMD/Header/MdSelfLink))}">see more</a></s>
96                                                                                                               
97                                                </xsl:if>
98                                                <xsl:apply-templates select="ResourceProxy[position() &lt; $resourceref_limit]" />
99                                        </ul>
100                                </div>
101                        </xsl:when>
102                        <xsl:otherwise>
103                                <ul>
104                                        <xsl:apply-templates />
105                                </ul>                   
106                        </xsl:otherwise>
107                </xsl:choose>
108               
109</xsl:template> 
110       
111        <xsl:template match="ResourceProxy" >
112       
113                        <xsl:variable name="href" >                                             
114                                <xsl:choose>
115                                        <xsl:when test="ResourceType='Resource'">
116                                                        <xsl:value-of select="ResourceRef" />
117                                        </xsl:when>
118                                        <xsl:otherwise>
119                                                        <xsl:value-of select="my:formURL('record', 'htmlpage', my:encodePID(ResourceRef))" />
120                                        </xsl:otherwise>
121                                </xsl:choose>                           
122                        </xsl:variable>
123                       
124                        <xsl:variable name="class" select=" if (ResourceType='Resource') then 'external' else 'internal'" />
125                       
126                <li><span class="label" ><xsl:value-of select="ResourceType" />: </span> 
127                                <a class="{$class}" href="{$href}" target="_blank" >
128                                                <xsl:value-of select="ResourceRef" />
129                                </a>
130                </li>
131        </xsl:template> 
132
133</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.