source: cats/ISOcat/trunk/mod-ISOcat-interface-rest/representations/html/DC-history.xsl @ 2912

Last change on this file since 2912 was 2912, checked in by mwindhouwer, 11 years ago

M mod-ISOcat-interface-rest/representations/atom/DC-history.xsl
M mod-ISOcat-interface-rest/representations/html/DC-history.xsl

  • removed milliseconds from the timestamp
  • fall back to unknown if the editor isn't known
File size: 3.1 KB
Line 
1<?xml version="1.0"?>
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:isocat="http://www.isocat.org/"
7  xmlns:dcr="http://www.isocat.org/ns/dcr"
8  xmlns:dcif="http://www.isocat.org/ns/dcif"
9>
10
11        <!--
12        don't use the xhtml output method,
13        NK (?) will pretty print it during
14        serialization and break the layout
15        -->
16        <xsl:output method="xml" encoding="utf-8"/>
17
18        <xsl:param name="props"/>
19       
20        <xsl:template match="text()"/>
21       
22        <xsl:function name="isocat:pid">
23                <xsl:param name="node"/>
24                <xsl:value-of select="$props//site"/>
25                <xsl:text>rest/dc/</xsl:text>
26                <xsl:value-of select="$node/(@id|@dc|@ref)"/>
27        </xsl:function>
28
29        <xsl:function name="isocat:link">
30                <xsl:param name="node"/>
31                <span>
32                        <xsl:text>/</xsl:text>
33                        <a href="{isocat:pid($node)}">
34                                <xsl:choose>
35                                        <xsl:when test="exists($node/@identifier)">
36                                                <xsl:value-of select="$node/@identifier"/>
37                                        </xsl:when>
38                                        <xsl:otherwise>
39                                                <xsl:value-of select="isocat:pid($node)"/>
40                                        </xsl:otherwise>
41                                </xsl:choose>
42                        </a>
43                        <xsl:text>/</xsl:text>
44                        <xsl:if test="exists($node/@name) and ($node/@name!=$node/@identifier)">
45                                <xsl:text> (</xsl:text>
46                                <xsl:value-of select="$node/@name"/>
47                                <xsl:text>)</xsl:text>
48                        </xsl:if>
49                </span>
50        </xsl:function>
51       
52        <xsl:function name="isocat:timestamp">
53                <xsl:param name="ts"/>
54                <xsl:sequence select="replace($ts,'\..*','')"/>
55        </xsl:function>
56
57        <xsl:template match="change">
58                <dt>
59                        <a name="c{@isocat:id}">
60                                <xsl:value-of select="isocat:timestamp(@timestamp)"/>
61                                <xsl:text> - </xsl:text>
62                                <xsl:choose>
63                                        <xsl:when test="exists(user/name)">
64                                                <xsl:value-of select="user/name"/>
65                                        </xsl:when>
66                                        <xsl:otherwise>
67                                                <i>unknown</i>
68                                        </xsl:otherwise>
69                                </xsl:choose>
70                        </a>
71                </dt>
72                <dd>
73                        <xsl:choose>
74                                <xsl:when test="normalize-space(description)">
75                                        <xsl:value-of select="description"/>
76                                </xsl:when>
77                                <xsl:otherwise>
78                                        <i>no description of the change</i>
79                                </xsl:otherwise>
80                        </xsl:choose>
81                </dd>
82        </xsl:template>
83       
84        <xsl:function name="isocat:title">
85                <xsl:param name="node"/>
86                <span>
87                        <xsl:text>History of </xsl:text>
88                        <xsl:copy-of select="isocat:link($node)"/>
89                        <xsl:text> - </xsl:text>
90                        <xsl:value-of select="$node/@version"/>
91                </span>
92        </xsl:function>
93       
94        <xsl:template match="/history">
95                <xsl:variable name="title" select="isocat:title(dc)"/>
96                <html>
97                        <head>
98                                <xsl:if test="exists($title) and (normalize-space(string($title))!='')">
99                                        <title>
100                                                <xsl:value-of select="string($title)"/>
101                                        </title>
102                                </xsl:if>
103                                <link rel="stylesheet" href="{$props//site}interface/JSXAPPS/ISOcat/css/style.css" type="text/css"/>
104                        </head>
105                        <body>
106                                <div class="title">
107                                        <xsl:copy-of select="$title"/>
108                                </div>
109                                <div class="main">
110                                        <xsl:choose>
111                                                <xsl:when test="exists(change)">
112                                                        <dl>
113                                                                <xsl:apply-templates/>
114                                                        </dl>
115                                                </xsl:when>
116                                                <xsl:otherwise>
117                                                        <xsl:text>There is no change history for this data category.</xsl:text>
118                                                </xsl:otherwise>
119                                        </xsl:choose>
120                                </div>
121                        </body>
122                </html>
123        </xsl:template>
124
125</xsl:stylesheet>
Note: See TracBrowser for help on using the repository browser.