1
|
<?xml version="1.0"?>
|
2
|
<!--
|
3
|
* rowcol.xsl
|
4
|
*
|
5
|
* This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
|
6
|
* convert an XML file that is the result of a SQL query using Oracle's
|
7
|
* XSQL tool to HTML format using a generic tabular display. Cascading
|
8
|
* Style Sheets (CSS) are used to create some styling effects.
|
9
|
-->
|
10
|
<!--
|
11
|
| Author: smuench
|
12
|
+-->
|
13
|
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
14
|
|
15
|
|
16
|
<xsl:template match="/">
|
17
|
<html>
|
18
|
<head>
|
19
|
<link rel="stylesheet" type="text/css" href="./rowcol.css" />
|
20
|
</head>
|
21
|
<body class="page">
|
22
|
<center><h1>XSL Transformed View</h1></center>
|
23
|
<xsl:apply-templates/>
|
24
|
</body>
|
25
|
</html>
|
26
|
</xsl:template>
|
27
|
|
28
|
<xsl:template match="ROWSET">
|
29
|
<center>
|
30
|
<table border="0" cellpadding="4">
|
31
|
<xsl:choose>
|
32
|
<xsl:when test="ROW">
|
33
|
<xsl:for-each select="ROW[1]">
|
34
|
<tr>
|
35
|
<xsl:for-each select="*[not(starts-with(name(.),'H_'))]">
|
36
|
<th align="left">
|
37
|
<xsl:attribute name="class">
|
38
|
<xsl:choose>
|
39
|
<xsl:when test="position() mod 2 = 1">colodd</xsl:when>
|
40
|
<xsl:when test="position() mod 2 = 0">coleven</xsl:when>
|
41
|
</xsl:choose>
|
42
|
</xsl:attribute>
|
43
|
<xsl:value-of select="name(.)"/>
|
44
|
</th>
|
45
|
</xsl:for-each>
|
46
|
</tr>
|
47
|
</xsl:for-each>
|
48
|
<xsl:apply-templates/>
|
49
|
</xsl:when>
|
50
|
<xsl:otherwise>
|
51
|
<tr><td>No Matches</td></tr>
|
52
|
</xsl:otherwise>
|
53
|
</xsl:choose>
|
54
|
</table>
|
55
|
</center>
|
56
|
</xsl:template>
|
57
|
|
58
|
<xsl:template match="ROW">
|
59
|
<tr>
|
60
|
<xsl:attribute name="class">
|
61
|
<xsl:choose>
|
62
|
<xsl:when test="position() mod 2 = 1">rowodd</xsl:when>
|
63
|
<xsl:when test="position() mod 2 = 0">roweven</xsl:when>
|
64
|
</xsl:choose>
|
65
|
</xsl:attribute>
|
66
|
<xsl:for-each select="*[not(starts-with(name(.),'H_'))]">
|
67
|
<td>
|
68
|
<xsl:attribute name="class">
|
69
|
<xsl:choose>
|
70
|
<xsl:when test="position() mod 2 = 1">colodd</xsl:when>
|
71
|
<xsl:when test="position() mod 2 = 0">coleven</xsl:when>
|
72
|
</xsl:choose>
|
73
|
</xsl:attribute>
|
74
|
<xsl:apply-templates select='.'/>
|
75
|
</td>
|
76
|
</xsl:for-each>
|
77
|
</tr>
|
78
|
</xsl:template>
|
79
|
|
80
|
</xsl:stylesheet>
|