给出一个类似此片段的XML(将要生成),我需要使用基于XSLT 1.0的div条目生成一个网页,如下所示:
<div class="rTable">
<div class="rTableRowS">
<div class="hCell">SIT</div>
</div>
<div class="rTableRowS">
<div class="rTableCellS">Header 1</div>
<div class="rTableCellS">Header 2</div>
<div class="rTableCellS">Header 3</div>
<div class="rTableCellS">Header 4</div>
</div>
<div class="rTableRowQ">
<div class="rTableCellQ">a1</div>
<div class="rTableCellQ">single</div>
<div class="rTableCellQ">a2</div>
<div class="rTableCellQ">secondary</div>
<div class="rTableCellQ">a3</div>
<div class="rTableCellQ">single</div>
<div class="rTableCellQ">a4</div>
<div class="rTableCellQ">secondary</div>
</div>
<div class="rTableRowS">
<div class="rTableCellS">header 5</div>
<div class="rTableCellS">header 6</div>
<div class="rTableCellS">header 7</div>
<div class="rTableCellS">header 8</div>
</div>
<div class="rTableRowQ">
<div class="rTableCellQ">b5</div>
<div class="rTableCellQ">single</div>
<div class="rTableCellQ">b6</div>
<div class="rTableCellQ">secondary</div>
<div class="rTableCellQ">b7</div>
<div class="rTableCellQ">single</div>
<div class="rTableCellQ">b8</div>
<div class="rTableCellQ">secondary</div>
</div>
所需的输出(外观):
SIT
Header 1 ¦ Header 2 ¦ Header 3 ¦ Header 4
a1 ¦ single ¦ a2 ¦ secondary ¦ a3 ¦ single ¦ a4 ¦ secondary
Header 5 ¦ Header 6 ¦ Header 7 ¦ Header 8
b5 ¦ single ¦ b6 ¦ secondary ¦ b7 ¦ single ¦ b8 ¦ secondary
以此类推。
什么是实现列匹配(基于div)的简单XSLT1.0转换。我可以将输入XML调整到某个级别,例如更改类条目。
答案 0 :(得分:0)
使用具有嵌套display = table条目的div解决:一行包含再次包含表的单元格。