root/tags/lgt291/xml/lgthtml.xsl

Revision 7, 5.6 KB (checked in by pmoura, 7 years ago)

Corrected compiler bug in the error checking code of directives info/1 and info/2.
Change the "mi" example objects loading order to avoid some "unknown entity" warnings.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet
3    version="1.0"
4    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
6
7<xsl:output
8    method="html"
9    doctype-public="-//W3C//DTD HTML 4.01//EN"
10    doctype-system="http://www.w3.org/TR/html4/strict.dtd"/>
11
12
13<!--
14%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15%
16%  Logtalk - Object oriented extension to Prolog
17%  Release 2.9.1
18%
19%  Copyright (c) 1998-2001 Paulo Moura.  All Rights Reserved.
20%
21%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
22-->
23
24
25<xsl:template match="/">
26    <html>
27    <head>
28        <title><xsl:value-of select="logtalk/entity/name" /></title>
29        <link rel="stylesheet" href="logtalk.css" type="text/css" />
30    </head>
31    <body>
32        <hr />
33        <h4 class="type"><xsl:value-of select="logtalk/entity/type" /></h4>
34        <h1 class="code"><xsl:value-of select="logtalk/entity/name" /></h1>
35        <xsl:apply-templates select="logtalk/entity" />
36        <hr />
37        <xsl:apply-templates select="logtalk/relations" />
38        <hr />
39        <xsl:apply-templates select="logtalk/predicates" />
40        <hr />
41    </body>
42    </html>
43</xsl:template>
44
45
46<xsl:template match="logtalk/entity">
47    <xsl:if test="comment">
48        <blockquote><xsl:value-of select="comment" /></blockquote>
49    </xsl:if>
50    <dl>
51    <xsl:if test="authors">
52        <dt>authors:</dt>
53            <dd><code><xsl:value-of select="authors" /></code></dd>
54    </xsl:if>
55    <xsl:if test="version">
56        <dt>version:</dt>
57            <dd><code><xsl:value-of select="version" /></code></dd>
58    </xsl:if>
59    <xsl:if test="date">
60        <dt>date:</dt>
61            <dd><code><xsl:value-of select="date" /></code></dd>
62    </xsl:if>
63    </dl>
64    <dl>
65        <dt>compilation:</dt>
66            <dd><code><xsl:value-of select="compilation" /></code></dd>
67    </dl>
68    <dl>
69    <xsl:for-each select="info">
70        <dt><xsl:value-of select="key" />:</dt>
71            <dd><code><xsl:value-of select="value" /></code></dd>
72    </xsl:for-each>
73    </dl>
74</xsl:template>
75
76
77<xsl:template match="logtalk/relations">
78    <xsl:choose>
79        <xsl:when test="*">
80            <xsl:if test="implements">
81            <dl>
82            <dt>implements:</dt>
83                <xsl:apply-templates select="implements" />
84            </dl>
85            </xsl:if>
86            <xsl:if test="imports">
87            <dl>
88            <dt>imports:</dt>
89                <xsl:apply-templates select="imports" />
90            </dl>
91            </xsl:if>
92            <xsl:if test="extends">
93            <dl>
94            <dt>extends:</dt>
95                <xsl:apply-templates select="extends" />
96            </dl>
97            </xsl:if>
98            <xsl:if test="instantiates">
99            <dl>
100            <dt>instantiates:</dt>
101                <xsl:apply-templates select="instantiates" />
102            </dl>
103            </xsl:if>
104            <xsl:if test="specializes">
105            <dl>
106            <dt>specializes:</dt>
107                <xsl:apply-templates select="specializes" />
108            </dl>
109            </xsl:if>
110            <xsl:if test="uses">
111            <dl>
112            <dt>uses:</dt>
113                <xsl:apply-templates select="uses" />
114            </dl>
115            </xsl:if>
116            <xsl:if test="calls">
117            <dl>
118            <dt>calls:</dt>
119                <xsl:apply-templates select="calls" />
120            </dl>
121            </xsl:if>
122        </xsl:when>
123        <xsl:otherwise> 
124            <h4 class="code">(no dependencies on other files)</h4>
125        </xsl:otherwise>
126    </xsl:choose>
127</xsl:template>
128
129
130<xsl:template match="logtalk/relations/uses">
131    <dd><code><a><xsl:attribute name="href"><xsl:value-of select="file" />.html</xsl:attribute><xsl:value-of select="name" /></a></code></dd>
132</xsl:template>
133
134
135<xsl:template match="logtalk/relations/calls">
136    <dd><code><a><xsl:attribute name="href"><xsl:value-of select="file" />.html</xsl:attribute><xsl:value-of select="name" /></a></code></dd>
137</xsl:template>
138
139
140<xsl:template match="logtalk/relations/*">
141    <dd><code><xsl:value-of select="scope" /><xsl:text> </xsl:text><a><xsl:attribute name="href"><xsl:value-of select="file" />.html</xsl:attribute><xsl:value-of select="name" /></a></code></dd>
142</xsl:template>
143
144
145<xsl:template match="logtalk/predicates">
146    <h1>Public interface</h1>
147    <xsl:choose>
148        <xsl:when test="public/predicate">
149            <xsl:apply-templates select="public/predicate" />
150        </xsl:when>
151        <xsl:when test="/logtalk/relations/*">     
152            <h4 class="code">(see related entities)</h4>
153        </xsl:when>
154        <xsl:otherwise>
155            <h4 class="code">(none)</h4>
156        </xsl:otherwise>
157    </xsl:choose>
158    <h1>Protected interface</h1>
159    <xsl:choose>
160        <xsl:when test="protected/predicate">
161            <xsl:apply-templates select="protected/predicate" />
162        </xsl:when>
163        <xsl:when test="/logtalk/relations/*">     
164            <h4 class="code">(see related entities)</h4>
165        </xsl:when>
166        <xsl:otherwise>
167            <h4 class="code">(none)</h4>
168        </xsl:otherwise>
169    </xsl:choose>
170    <h1>Private predicates</h1>
171    <xsl:choose>
172        <xsl:when test="private/predicate">
173            <xsl:apply-templates select="private/predicate" />
174        </xsl:when>
175        <xsl:when test="/logtalk/relations/*">     
176            <h4 class="code">(see related entities)</h4>
177        </xsl:when>
178        <xsl:otherwise>
179            <h4 class="code">(none)</h4>
180        </xsl:otherwise>
181    </xsl:choose>
182</xsl:template>
183
184
185<xsl:template match="*/predicate">
186    <h4 class="code"><xsl:value-of select="name" /></h4>
187    <xsl:if test="comment">
188        <blockquote><xsl:value-of select="comment" /></blockquote>
189    </xsl:if>
190    <dl class="predicate">
191        <dt>compilation:</dt>
192            <dd><code><xsl:value-of select="compilation" /></code></dd>
193        <xsl:if test="template">
194        <dt>template:</dt>
195            <dd><code><xsl:value-of select="template" /></code></dd>
196        </xsl:if>
197        <xsl:if test="meta">
198        <dt>metapredicate template:</dt>
199            <dd><code><xsl:value-of select="meta" /></code></dd>
200        </xsl:if>
201        <xsl:if test="mode">
202        <dt>mode - number of solutions:</dt>
203        <xsl:for-each select="mode">
204            <dd><code><xsl:value-of select="template" /><xsl:text> - </xsl:text><xsl:value-of select="solutions" /></code></dd>
205        </xsl:for-each>
206        </xsl:if>
207    </dl>
208    <dl class="predicate">
209        <xsl:for-each select="info">
210        <dt><xsl:value-of select="key" />:</dt>
211            <dd><code><xsl:value-of select="value" /></code></dd>
212        </xsl:for-each>
213    </dl>
214</xsl:template>
215
216
217</xsl:stylesheet>
Note: See TracBrowser for help on using the browser.