aboutsummaryrefslogtreecommitdiff
path: root/t/test-site/src/common/du2html.xsl
blob: 88c70b0c90d8c55379168a62eac42c9ad2a64358 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?xml version="1.0" encoding="utf-8"?>
<x:stylesheet xmlns:x="http://www.w3.org/1999/XSL/Transform"
              xmlns="http://www.w3.org/1999/xhtml"
              xmlns:wc="http://webcoso.thenautilus.net/"
              version="1.0"
              >
 
 <x:import href="reST.xsl"/>
 
 <x:param name="language" select="'en'"/>
 <x:param name="path"/>
 <x:param name="filename"/>
 
 <x:output method="html" encoding="utf-8"
           doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
           indent="yes"/>
 
 <x:template match="reference">
  <x:element name="a">
   <x:attribute name="href">
    <x:choose>
     <x:when test="@refid">
      <x:value-of select="concat('#', @refid)" />
     </x:when>
     <x:when test="@refuri">
      <x:value-of select="@refuri" />
     </x:when>
    </x:choose>
   </x:attribute>
 
   <x:choose>
    <x:when test="@refuri and string(.)=string(@refuri)">
     <x:apply-templates select="wc:title-for($language,$filename,@refuri)"/>
    </x:when>
    <x:otherwise>
     <x:apply-templates />
    </x:otherwise>
   </x:choose>
  </x:element>
 </x:template>
 
 <x:template match="/document">
  <html xml:lang="{$language}" lang="{$language}">
   <head>
    <title><x:value-of select="title"/></title>
   </head>
   <body>
    <div>
     <h1><x:apply-templates select="title/node()"/></h1>
     <x:apply-templates/>
    </div>
    <div>
     <x:apply-templates select="wc:tagged()"/>
    </div>
    <div>
     <x:apply-templates select="wc:dates-for($language,$filename,'./')"/>
    </div>
   </body>
  </html>
 </x:template>
 
 <x:template match="/wc:dates">
  Creato: <x:value-of select="wc:creation-date"/>
  Ultima modifica: <x:value-of select="wc:last-change"/>
 </x:template>
 
 <x:template match="/wc:tags">
  <dl>
   <x:apply-templates/>
  </dl>
 </x:template>
 
 <x:template match="wc:tag">
  <dt><x:apply-templates select="wc:title-for($language,$filename,concat('/tags/',@name,'/'))"/></dt>
  <dd>
   <ul>
    <x:apply-templates/>
   </ul>
  </dd>
 </x:template>
 
 <x:template match="wc:doc">
  <li>
   <a href="{@uri}"><x:apply-templates select="wc:title-for($language,$filename,@uri)"/></a>
   (<x:apply-templates/>)
  </li>
 </x:template>
 
 <x:template match="wc:lang">
  <x:choose>
   <x:when test=".!=$language">
    <a href="{../@uri}{.}"><x:value-of select="."/></a>
   </x:when>
   <x:otherwise>
    <x:value-of select="."/>
   </x:otherwise>
  </x:choose>
  <x:if test="following-sibling::wc:lang"> | </x:if>
 </x:template>
 
</x:stylesheet>