1 |
<!DOCTYPE xsl:stylesheet> |
2 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
3 |
|
4 |
<xsl:output method="xhtml" omit-xml-declaration='yes' media-type="text/html" encoding="utf-8"/> |
5 |
|
6 |
<xsl:template name="mbody"> |
7 |
<p> |
8 |
<!-- horrible hack --> |
9 |
<xsl:apply-templates select="child::node()[1][name() != 'member']"/> |
10 |
<xsl:apply-templates select="child::node()[2][name() = 'p']"/> |
11 |
</p> |
12 |
<table border="1" width="100%"> |
13 |
<tr> |
14 |
<th width="10%">NAME</th> |
15 |
<th width="8%">TYPE</th> |
16 |
<th width="4%">VALUE</th> |
17 |
<th>DESCRIPTION</th> |
18 |
<th width="10%">GUARD</th> |
19 |
</tr> |
20 |
<xsl:apply-templates select="child::member"/> |
21 |
</table> |
22 |
</xsl:template> |
23 |
|
24 |
<xsl:template match="member"> |
25 |
<tr> |
26 |
<td><xsl:value-of select="@name"/></td> |
27 |
<td><xsl:value-of select="@type"/></td> |
28 |
<td><xsl:value-of select="@value"/> </td> |
29 |
<td> |
30 |
<!-- horrible hack --> |
31 |
<xsl:if test="following-sibling::node()[1][name() != 'member']"> |
32 |
<xsl:apply-templates select="following-sibling::node()[1]"/> |
33 |
<xsl:if test="following-sibling::node()[2][name() != 'member']"> |
34 |
<xsl:apply-templates select="following-sibling::node()[2]"/> |
35 |
<xsl:if test="following-sibling::node()[3][name() != 'member']"> |
36 |
<xsl:apply-templates select="following-sibling::node()[3]"/> |
37 |
<xsl:if test="following-sibling::node()[4][name() != 'member']"> |
38 |
<xsl:apply-templates select="following-sibling::node()[4]"/> |
39 |
<xsl:if test="following-sibling::node()[5][name() != 'member']"> |
40 |
<xsl:apply-templates select="following-sibling::node()[5]"/> |
41 |
</xsl:if> |
42 |
</xsl:if> |
43 |
</xsl:if> |
44 |
</xsl:if> |
45 |
</xsl:if> |
46 |
  |
47 |
</td> |
48 |
<td> |
49 |
<b><xsl:value-of select="@guard-member"/></b> |
50 |
<xsl:text> </xsl:text><xsl:value-of select="@guard-cond"/> |
51 |
  |
52 |
</td> |
53 |
</tr> |
54 |
</xsl:template> |
55 |
|
56 |
<xsl:template match="type"> |
57 |
<h4>TYPE <xsl:value-of select="@name"/></h4> |
58 |
BASE TYPE <xsl:value-of select="@type"/>, LENGTH <xsl:value-of select="@length"/>, MULTIPLIER <xsl:value-of select="@multiplier"/> |
59 |
<br/> |
60 |
</xsl:template> |
61 |
|
62 |
<xsl:template match="enum|set"> |
63 |
<h4><xsl:value-of select="name()"/>: <xsl:value-of select="@name"/></h4> |
64 |
<xsl:call-template name="mbody"/> |
65 |
</xsl:template> |
66 |
|
67 |
<xsl:template match="struct"> |
68 |
<h4>STRUCTURE <xsl:value-of select="@name"/></h4> |
69 |
<xsl:if test="@class"> |
70 |
CLASS: <xsl:value-of select="@class"/><br/> |
71 |
</xsl:if> |
72 |
<xsl:call-template name="mbody"/> |
73 |
</xsl:template> |
74 |
|
75 |
<xsl:template match="message"> |
76 |
<h4> |
77 |
<xsl:if test="@src='server'"><a name="{concat('S', @type)}"/>ORIGIN: SERVER;</xsl:if> |
78 |
<xsl:if test="@src='client'"><a name="{concat('C', @type)}"/>ORIGIN: CLIENT;</xsl:if> |
79 |
MESSAGE: <xsl:value-of select="@name"/> |
80 |
</h4> |
81 |
NUMERIC TYPE (hex): <xsl:value-of select="@type"/> |
82 |
<xsl:if test="@src='server'"> |
83 |
<xsl:variable name="ref" select="@name"/> |
84 |
<xsl:for-each select="//message[@src='client' and descendant::ref[@reply=$ref]]"> |
85 |
(possibly in response to |
86 |
<a href="{concat('#C', @type)}"><xsl:value-of select="concat(@name, '(', @type, ')')"/></a> |
87 |
) |
88 |
</xsl:for-each> |
89 |
</xsl:if> |
90 |
<xsl:call-template name="mbody"/> |
91 |
</xsl:template> |
92 |
|
93 |
<xsl:template match="ref"> |
94 |
<xsl:variable name="ref" select="concat(@ref, @reply)"/> |
95 |
<xsl:for-each select="//message[@src='server' and @name=$ref]"> |
96 |
<a href="{concat('#S', @type)}"><xsl:value-of select="concat(@name, '(', @type, ')')"/></a> |
97 |
</xsl:for-each> |
98 |
</xsl:template> |
99 |
|
100 |
<xsl:template match="@*|node()"> |
101 |
<xsl:copy> |
102 |
<xsl:apply-templates select="@*|node()"/> |
103 |
</xsl:copy> |
104 |
</xsl:template> |
105 |
|
106 |
</xsl:stylesheet> |
107 |
|