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:template match="change"> |
---|
53 | <dt> |
---|
54 | <a name="c{@isocat:id}"> |
---|
55 | <xsl:value-of select="@timestamp"/> |
---|
56 | <xsl:text> - </xsl:text> |
---|
57 | <xsl:choose> |
---|
58 | <xsl:when test="exists(user/name)"> |
---|
59 | <xsl:value-of select="user/name"/> |
---|
60 | </xsl:when> |
---|
61 | <xsl:otherwise> |
---|
62 | <i>unknown</i> |
---|
63 | </xsl:otherwise> |
---|
64 | </xsl:choose> |
---|
65 | </a> |
---|
66 | </dt> |
---|
67 | <dd> |
---|
68 | <xsl:choose> |
---|
69 | <xsl:when test="normalize-space(description)"> |
---|
70 | <xsl:value-of select="description"/> |
---|
71 | </xsl:when> |
---|
72 | <xsl:otherwise> |
---|
73 | <i>no description of the change</i> |
---|
74 | </xsl:otherwise> |
---|
75 | </xsl:choose> |
---|
76 | </dd> |
---|
77 | </xsl:template> |
---|
78 | |
---|
79 | <xsl:function name="isocat:title"> |
---|
80 | <xsl:param name="node"/> |
---|
81 | <span> |
---|
82 | <xsl:text>History of </xsl:text> |
---|
83 | <xsl:copy-of select="isocat:link($node)"/> |
---|
84 | <xsl:text> - </xsl:text> |
---|
85 | <xsl:value-of select="$node/@version"/> |
---|
86 | </span> |
---|
87 | </xsl:function> |
---|
88 | |
---|
89 | <xsl:template match="/history"> |
---|
90 | <xsl:variable name="title" select="isocat:title(dc)"/> |
---|
91 | <html> |
---|
92 | <head> |
---|
93 | <xsl:if test="exists($title) and (normalize-space(string($title))!='')"> |
---|
94 | <title> |
---|
95 | <xsl:value-of select="string($title)"/> |
---|
96 | </title> |
---|
97 | </xsl:if> |
---|
98 | <link rel="stylesheet" href="{$props//site}interface/JSXAPPS/ISOcat/css/style.css" type="text/css"/> |
---|
99 | </head> |
---|
100 | <body> |
---|
101 | <div class="title"> |
---|
102 | <xsl:copy-of select="$title"/> |
---|
103 | </div> |
---|
104 | <div class="main"> |
---|
105 | <xsl:choose> |
---|
106 | <xsl:when test="exists(change)"> |
---|
107 | <dl> |
---|
108 | <xsl:apply-templates/> |
---|
109 | </dl> |
---|
110 | </xsl:when> |
---|
111 | <xsl:otherwise> |
---|
112 | <xsl:text>There is no change history for this data category.</xsl:text> |
---|
113 | </xsl:otherwise> |
---|
114 | </xsl:choose> |
---|
115 | </div> |
---|
116 | </body> |
---|
117 | </html> |
---|
118 | </xsl:template> |
---|
119 | |
---|
120 | </xsl:stylesheet> |
---|