Web edits
[beagleboard.org.git] / db / helma.xsl
blobefdc5896fa8d9d7d9fa4258c896169489d6d49a4
1 <?xml version="1.0" encoding="iso-8859-15"?>
3 <xsl:stylesheet
4 version="1.0"
5 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
6 xmlns:hop="http://www.helma.org/docs/guide/features/database"
9 <xsl:output method="html"/>
11 <xsl:variable name="id" select="/xmlroot/hopobject/@id"/>
12 <xsl:variable name="name" select="/xmlroot/hopobject/@name"/>
13 <xsl:variable name="prototype" select="/xmlroot/hopobject/@prototype"/>
14 <xsl:variable name="parent" select="/xmlroot/hopobject/hop:parent"/>
15 <xsl:variable name="children" select="/xmlroot/hopobject/hop:child"/>
17 <xsl:template match="/">
18 <html>
19 <head>
20 <title><xsl:value-of select="$id"/>.xml (Hop XML Database File)</title>
21 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
22 </head>
23 <body bgcolor="white">
25 <!-- main navigation -->
26 <h2>
27 <xsl:if test="$id = 0">root</xsl:if>
28 <xsl:if test="$id &gt; 0">
29 <a href="0.xml">root</a> : HopObject <xsl:value-of select="$id"/>
30 </xsl:if>
31 </h2>
33 <!-- table header -->
34 <table border="0" cellspacing="1" cellpadding="5" bgcolor="gray">
35 <tr bgcolor="white">
36 <th>Name</th>
37 <th>Value</th>
38 </tr>
40 <!-- _name, _prototype and _parent properties -->
41 <xsl:if test="$name">
42 <xsl:call-template name="getOutputItem">
43 <xsl:with-param name="name">_name</xsl:with-param>
44 <xsl:with-param name="value" select="$name"/>
45 </xsl:call-template>
46 </xsl:if>
47 <xsl:if test="$prototype">
48 <xsl:call-template name="getOutputItem">
49 <xsl:with-param name="name">_prototype</xsl:with-param>
50 <xsl:with-param name="value" select="$prototype"/>
51 </xsl:call-template>
52 </xsl:if>
53 <xsl:if test="$parent">
54 <xsl:call-template name="getOutputItem">
55 <xsl:with-param name="name">_parent</xsl:with-param>
56 <xsl:with-param name="value">
57 HopObject <xsl:value-of select="$parent/@idref"/>
58 </xsl:with-param>
59 <xsl:with-param name="href">
60 <xsl:value-of select="$parent/@idref"/>.xml
61 </xsl:with-param>
62 </xsl:call-template>
63 </xsl:if>
65 <!-- _children collection -->
66 <xsl:if test="count($children) &gt; 0">
67 <tr bgcolor="white">
68 <td valign="top" nowrap="nowrap">_children</td>
69 <td>
70 <xsl:for-each select="$children">
71 <xsl:sort select="@idref" data-type="number"/>
72 <a href="{@idref}.xml"><nowrap><xsl:value-of select="@prototyperef"/>
73 <xsl:text> </xsl:text><xsl:value-of select="@idref"/></nowrap></a>
74 <xsl:if test="position() &lt; count($children)">
75 <xsl:text>, </xsl:text>
76 </xsl:if>
77 </xsl:for-each>
78 </td>
79 </tr>
80 </xsl:if>
82 <!-- primitive properties -->
83 <xsl:for-each select="/xmlroot/hopobject/*">
84 <xsl:sort select="concat(@propertyname, name())"/>
85 <xsl:choose>
86 <xsl:when test="name() = 'hop:parent'"/>
87 <xsl:when test="name() = 'hop:child'"/>
88 <xsl:when test="@idref">
89 <xsl:call-template name="getOutputItem">
90 <xsl:with-param name="name">
91 <xsl:call-template name="getPropertyName"/>
92 </xsl:with-param>
93 <xsl:with-param name="value">
94 HopObject <xsl:value-of select="@idref"/>
95 </xsl:with-param>
96 <xsl:with-param name="href">
97 <xsl:value-of select="@idref"/>.xml
98 </xsl:with-param>
99 </xsl:call-template>
100 </xsl:when>
101 <xsl:otherwise>
102 <xsl:call-template name="getOutputItem">
103 <xsl:with-param name="name">
104 <xsl:call-template name="getPropertyName"/>
105 </xsl:with-param>
106 <xsl:with-param name="value"><xsl:value-of select="text()"/></xsl:with-param>
107 </xsl:call-template>
108 </xsl:otherwise>
109 </xsl:choose>
110 </xsl:for-each>
112 </table>
113 </body>
114 </html>
115 </xsl:template>
117 <!-- helper template to compose a hopobject's name -->
118 <xsl:template name="getName">
119 <xsl:param name="name"/>
120 <xsl:choose>
121 <xsl:when test="substring-after($name, 'HopObject ') = '0'">
122 root
123 </xsl:when>
124 <xsl:otherwise>
125 <xsl:value-of select="$name"/>
126 </xsl:otherwise>
127 </xsl:choose>
128 </xsl:template>
130 <!-- helper template to compose a property's name: if the element's
131 name is "property", the property name is in an attribute called
132 "propertyname". Otherwise, the element name is the element's name -->
133 <xsl:template name="getPropertyName">
134 <xsl:choose>
135 <xsl:when test="name() = 'property'">
136 <xsl:value-of select="@propertyname"/>
137 </xsl:when>
138 <xsl:otherwise>
139 <xsl:value-of select="name()"/>
140 </xsl:otherwise>
141 </xsl:choose>
142 </xsl:template>
144 <!-- helper template to compose a table row containing a property's data -->
145 <xsl:template name="getOutputItem">
146 <xsl:param name="name"/>
147 <xsl:param name="value"/>
148 <xsl:param name="href"/>
150 <xsl:variable name="display">
151 <xsl:call-template name="getName">
152 <xsl:with-param name="name" select="$value"/>
153 </xsl:call-template>
154 </xsl:variable>
156 <tr bgcolor="white">
157 <td valign="top" nowrap="nowrap"><xsl:value-of select="$name"/></td>
158 <td><xsl:choose>
159 <xsl:when test="$href">
160 <a href="{$href}"><xsl:value-of select="$display"/></a>
161 </xsl:when>
162 <xsl:otherwise>
163 <xsl:value-of select="$display"/>
164 </xsl:otherwise>
165 </xsl:choose></td>
166 </tr>
167 </xsl:template>
169 </xsl:stylesheet>