blob: 8c6258247699845806fab3c7c60740d73f6b73a3 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<stx:transform xmlns:stx="http://stx.sourceforge.net/2002/ns"
xmlns:sql="http://apache.org/cocoon/SQL/2.0"
version="1.0">
<stx:template match="sql:rowset">
<html>
<head>
<title>Table</title>
<link href="/styles/main.css" type="text/css" rel="stylesheet"/>
</head>
<body>
<table>
<stx:process-children group="list"/>
</table>
</body>
</html>
</stx:template>
<stx:group name="list">
<stx:buffer name="first-row"/>
<!-- Use data from the first row two times, first for header names
and then for content -->
<stx:template match="sql:row[1]">
<stx:result-buffer name="first-row">
<stx:process-children group="copy"/>
</stx:result-buffer>
<tr>
<stx:process-buffer name="first-row" group="header"/>
</tr>
<tr>
<stx:process-buffer name="first-row"/>
</tr>
</stx:template>
<stx:template match="sql:row">
<tr>
<stx:process-children/>
</tr>
</stx:template>
<stx:template match="sql:*">
<td>
<stx:value-of select="."/>
</td>
</stx:template>
</stx:group>
<!-- Copy everything -->
<stx:group name="copy">
<stx:template match="node()">
<stx:copy attributes="@*">
<stx:process-children/>
</stx:copy>
</stx:template>
</stx:group>
<!-- Use element names for header -->
<stx:group name="header">
<stx:template match="sql:*">
<th>
<stx:value-of select="local-name()"/>
</th>
</stx:template>
</stx:group>
</stx:transform>