我有下面的XML文檔:XSLT 1.0文本清單到單個元素和刪除重複
<?xml version="1.0" encoding="UTF-8"?>
<cars>
<car body="Wagon">
<text>Red</text>
</car>
<car body="Sedan">
<text>Yellow</text>
</car>
<car body="Sedan">
<text></text>
</car>
<car body="Wagon">
<textlist>
<text>Red</text>
<text>Green</text>
<text>Black</text>
<text>Blue</text>
</textlist>
</car>
<car body="Sedan">
<textlist>
<text>Yellow</text>
<text>Orange</text>
</textlist>
</car>
<car body="Fastback">
<textlist>
<text>Yellow</text>
<text>Red</text>
<text>Green</text>
<text>Black</text>
<text>Blue</text>
</textlist>
</car>
<car body="Fastback">
<textlist>
<text>Pink</text>
<text>Red</text>
<text>Orange</text>
</textlist>
</car>
</cars>
使用XSLT 1.0我需要將XML文檔轉換成這種格式:
<?xml version="1.0" encoding="UTF-8"?>
<cars>
<car type="Wagon">Red</car>
<car type="Sedan">Yellow</car>
<car type="Wagon">Green</car>
<car type="Wagon">Black</car>
<car type="Wagon">Blue</car>
<car type="Sedan">Orange</car>
</cars>
注意:
- 體= 「快背」 被排除
- 重複s的排除(紅色貨車 出現兩次)
- 文本清單的多個項目被放置在輸出XML個體 元件
- 忽略空值
爲什麼fastback被排除? – Woody 2012-07-13 09:30:58
爲什麼downvote? – 2012-10-08 09:59:32