If you want to map all entryFree
elements to HTML table rows (i.e. HTML tr
elements in an HTML table
) then set up the table
as needed and in a tbody
process all entryFree
elements, mapping them with a template to a tr
:
<xsl:output method="html" doctype-system="about:legacy-doctype"/>
<xsl:template match="/">
<html>
<head>
<title>Test</title>
</head>
<body>
<h1>Table</h1>
<table>
<thead>
<tr>
<th>free entry</th>
<th>forms/senses</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="//tei:entryFree"/>
</tbody>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="tei:entryFree">
<tr>
<td>
<xsl:value-of select="@sortKey"/>
</td>
<td>
<xsl:apply-templates/>
</td>
</tr>
</xsl:template>
You will need to remove the template matching tei:entryFree
obviously.
As for formatting the table, that is a HTML/CSS problem, HTML 4 https://www.w3.org/TR/html401/struct/tables.html#h-11.3.1 allows e.g.
<table rules="all" frame="border">
<thead>
<tr>
<th>free entry</th>
<th>forms/senses</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="//tei:entryFree"/>
</tbody>
</table>
in HTML5 I think using CSS is preferred:
<xsl:template match="/">
<html>
<head>
<title>Test</title>
<style>
table.dict {
border: 1px solid black;
border-collapse: collapse;
}
table.dict th, table.dict td {
border: 1px solid black;
}
</style>
</head>
<body>
<h1>Table</h1>
<table class="dict">
<thead>
<tr>
<th>free entry</th>
<th>forms/senses</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="//tei:entryFree"/>
</tbody>
</table>
</body>
</html>
</xsl:template>