我正在使用 XSLT 将 XML (tei) 文档转换为 HTML。目标是创建可以设置样式以显示为固定列的 div。
在文档中,列开始由 2 个空元素(里程碑和 cb)表示。“里程碑”表示文本流中的列数现在等于 n 属性。“cb” 标记一列的开始,它的 n 属性表示它在从左到右的顺序中的顺序。“cb”标签并不总是兄弟姐妹。
示例 xml:
<p>
<milestone unit="column" n="2"/>
<cb n="1"/>
M. Dudley
<lb/>
H. E. Ernshimer
<lb/>
M. M. Cash
<lb/>
John Wheatly
<lb/>
Jno W. Cash
<lb/>
<cb n="2"/>
R. L. Wilson
<lb/>
R. B. Ratliff L.C.C.
<lb/>
G. D Watkins Clk
<lb/>
A. C. Mayes
<lb/>
<pb/>
</p>
<p>
<note place="left margin">Jury 1863 Nov.</note>
<lb/>
<cb n="1"/>
D C Mitchenssson
<lb/>
A. W. Forde, Tm P
<lb/>
L S Thomson
<lb/>
Louis Martin
<hi rend="sup">c</hi>
Casslin
<lb/>
E. M. Stevens
<lb />
<cb n="2"/>
O Ross Baker Clk Caldwell County Court
<lb/>
N. Jones
<lb/>
S. W. M
<milestone unit="column" n="1"/>
<pb/>
<lb/>
John Garrett
</p>
期望的结果如下。类等于其前一个里程碑的 n 属性的 div:
<div class="column 2">
M. Dudley<br />
H. E. Ernshimer<br />
M. M. Cash<br />
John Wheatly<br />
Jno W. Cash<br />
...
</div>
<div class="column 2">
R. L. Wilson<br />
R. B. Ratliff L.C.C.<br />
G. D Watkins Clk<br />
A. C. Mayes<br />
Jas Crenshaw<br />
</div>
如何获取每对 cb 标签之间的所有内容,并将内容包装在包含的 div 中?我尝试过的一切都会导致一系列嵌套的 div。