]> matita.cs.unibo.it Git - helm.git/blob - helm/software/lambda-delta/xml/ld-html-library.xsl
Additional contribs.
[helm.git] / helm / software / lambda-delta / xml / ld-html-library.xsl
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!--
4     ||M||  This file is part of HELM, an Hypertextual, Electronic        
5     ||A||  Library of Mathematics, developed at the Computer Science     
6     ||T||  Department, University of Bologna, Italy.                     
7     ||I||                                                                
8     ||T||  HELM is free software; you can redistribute it and/or         
9     ||A||  modify it under the terms of the GNU General Public License   
10     \   /  version 2 or (at your option) any later version.              
11      \ /   This software is distributed as is, NO WARRANTY.              
12       V_______________________________________________________________ -->
13
14 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
15
16 <xsl:variable name="sort">color: rgb(128, 0, 255);</xsl:variable>
17 <xsl:variable name="cast">color: rgb(255, 0, 0);</xsl:variable>
18 <xsl:variable name="binder">color: rgb(0, 160, 0);</xsl:variable>
19 <xsl:variable name="global">color: rgb(0, 0, 255);</xsl:variable>
20
21 <xsl:template name="sp">
22    <xsl:text> </xsl:text>
23 </xsl:template>
24
25 <xsl:template name="sl">
26    <xsl:text>/</xsl:text>
27 </xsl:template>
28
29 <xsl:template name="fs">
30    <xsl:text>.&#x200B;</xsl:text>
31 </xsl:template>
32
33 <xsl:template name="op">
34    <xsl:text>(</xsl:text>
35 </xsl:template>
36
37 <xsl:template name="cp">
38    <xsl:text>)</xsl:text>
39 </xsl:template>
40
41 <xsl:template name="oa">
42    <span style="{$cast}">
43       <xsl:text>&lt;</xsl:text>
44    </span>
45 </xsl:template>
46
47 <xsl:template name="ca">
48    <span style="{$cast}">
49       <xsl:text>&gt;</xsl:text>
50    </span>
51 </xsl:template>
52
53 <xsl:template name="cn">
54    <span style="{$binder}">
55       <xsl:text>:</xsl:text>
56    </span>
57 </xsl:template>
58
59 <xsl:template name="eq">
60    <span style="{$binder}">
61       <xsl:text>=</xsl:text>
62    </span>
63 </xsl:template>
64
65 <xsl:template name="lambda">
66    <span style="{$binder}">
67       <xsl:text disable-output-escaping="yes">&amp;lambda;</xsl:text>
68    </span>
69 </xsl:template>
70
71 <xsl:template name="delta">
72    <span style="{$binder}">
73       <xsl:text disable-output-escaping="yes">&amp;delta;</xsl:text>
74    </span>
75 </xsl:template>
76
77 <xsl:template name="chi">
78    <span style="{$binder}">
79       <xsl:text disable-output-escaping="yes">&amp;chi;</xsl:text>
80    </span>
81 </xsl:template>
82
83 <xsl:template name="position">
84    <a name="" title="{@position}">
85       <xsl:value-of select="@name"/>
86    </a>
87 </xsl:template>
88
89 <xsl:template name="uri">
90    <xsl:variable name="url">
91       <xsl:value-of select="$baseurl"/>
92       <xsl:value-of select="substring-after(@uri,'ld:')"/>
93       <xsl:text>.html</xsl:text>
94    </xsl:variable>
95    <a href="{$url}" title="{@uri}"><xsl:value-of select="@name"/></a>
96 </xsl:template>
97
98 <xsl:template name="binder">
99    <xsl:value-of select="@name"/>
100 </xsl:template>
101
102 <xsl:template name="global">
103    <span style="{$global}">
104       <a name="" title="{@mark}">
105          <xsl:value-of select="@name"/>
106       </a>
107    </span>
108 </xsl:template>
109
110 <xsl:template name="mk_segment">
111    <xsl:param name="path"/>
112    <xsl:param name="name"/>
113    <xsl:variable name="url">
114       <xsl:value-of select="$baseurl"/>
115       <xsl:value-of select="substring-after($path,'ld:')"/>
116    </xsl:variable>
117    <a href="{$url}"><xsl:value-of select="$name"/></a>
118    <xsl:call-template name="sl"/>
119 </xsl:template>
120
121 <xsl:template name="mk_path">
122    <xsl:param name="rpath" select="@uri"/>
123    <xsl:variable name="newrpath" select="substring-after($rpath,'/')"/>
124    <xsl:choose>
125       <xsl:when test="$newrpath">
126          <xsl:variable name="segment" select="substring-before($rpath,$newrpath)"/>   
127          <xsl:call-template name="mk_segment">
128             <xsl:with-param name="path" select="substring-before(@uri,$newrpath)"/>
129             <xsl:with-param name="name" select="substring-before($segment,'/')"/>
130          </xsl:call-template>
131          <xsl:call-template name="mk_path">
132             <xsl:with-param name="rpath" select="$newrpath"/>
133          </xsl:call-template>
134       </xsl:when>
135       <xsl:otherwise>
136          <xsl:variable name="path" select="substring-before(@uri,$rpath)"/>
137          <xsl:value-of select="substring-after(@uri,$path)"/>
138       </xsl:otherwise>
139    </xsl:choose>
140 </xsl:template>
141
142 <xsl:template name="entity">
143    <xsl:call-template name="sp"/>
144    <xsl:call-template name="global"/>
145    <xsl:call-template name="sp"/>
146    <xsl:call-template name="op"/>
147    <xsl:call-template name="mk_path"/>
148    <xsl:call-template name="cp"/>
149 </xsl:template>
150
151 </xsl:stylesheet>