我有XML等,使得我不能改變如何在XSLT中將兄弟作爲孩子包含在內?
<entry>
<sn>1 a</sn>
<dt>:to run away often from danger or evil</dt>
<sn>b</sn>
<dt>:to hurry toward a place of security</dt>
<sn>2</sn>
<dt>:to pass away swiftly</dt>
</entry>
我試圖寫XSLT來得到它看起來像這樣
<div class="entry">
<div class="def_group">
<span class="def_group_number">1</span>
<div class="def_value">
<span class="def_value_letter">a</span>
<span class="the_def">:to run away often from danger or evil</span>
</div>
<div class="def_value">
<span class="def_value_letter">b</span>
<span class="the_def">:to hurry toward a place of security</span>
</div>
</div>
<div class="def_group">
<span class="def_group_number">2</span>
<div class="def_value">
<span class="the_def">:to pass away swiftly</span>
</div>
</div>
</div>
當我打破它,我有兩個問題真的。
如何使用XSLT 1.0分開< sn> (「letter」,「number」,「number letter」)這三種情況?
而且,在包含數字的情況下,如何編寫一個帶有< div>的模板,該模板將包含它的兄弟< dt>作爲孩子?