需要在第一列中放置“ entryFree”一词(第二个内容<form>
,而在第二行中将“ sense”等其他内容都放在同一行中,每对都带有边框)。示例XSL样式表仅包含格式。
样本XML:https://drive.google.com/file/d/1sNAbWw5xo1pgwK2QfQwPrbZtZt8uV48T/view?usp=sharing
花哨的XSL(许可证允许修改):https://github.com/michmech/tei-dictionary.xsl
答案 0 :(得分:0)
如果您想将所有entryFree
元素映射到HTML表行(即HTML tr
中的HTML table
元素),则根据需要在{ table
处理所有tbody
元素,并将它们与模板映射到entryFree
:
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>
匹配的模板。
关于格式化表格,这是HTML / CSS问题,HTML 4 https://www.w3.org/TR/html401/struct/tables.html#h-11.3.1允许例如
tei:entryFree
在HTML5中,我认为首选使用CSS:
<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>