1
我想包裝文本節點並使用XSL使用標籤構建它們。 下面是一個示例。如何使用XSL包裝帶有標籤的XML文本
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<root>
<section>
<container>
aaa
<box>
book
</box>
bbb
<box>
pen
</box>
ccc
<superscript>
3
</superscript>
ddd
</container>
</section>
</root>
是否有可能得到如下結果?
<div>
<p>aaa</p>
<div>book</div>
<p>bbb</p>
<div>pen</div>
<p>ccc<span>3</span>ddd</p>
</div>
我很高興你能再次幫助我!
總是感謝亞伯。我做到了!。我爲我的錯誤標籤道歉。我想從你那裏得到更多的提示。我重寫我的代碼都XSL和我想要的結果。我在XML中添加了'superscript'標籤和文本'ddd',我怎樣編寫XSL才能得到如下結果:'
ccc ddd
'?可能嗎? – tara@tara,是的,只需爲'superscript'添加一個匹配的模板,就完成了。這可能是一個好主意[在這裏閱讀模板匹配](http://stackoverflow.com/questions/2138774/understanding-apply-templates-matching)和[這裏(評估順序,然後一些)](HTTP ://stackoverflow.com/questions/1531664/in-what-order-do-templates-in-an-xslt-document-execute-and-do-they-match-on-the),因爲這是[核心的XSLT](http://lenzconsulting.com/how-xslt-works/)。隨意投票和[接受我的回答](http://stackoverflow.com/help/why-vote)如果它幫助你。 – Abel