我只是沒有得到如何複製在XSL中工作...我有一些重複節點的文檔,我想排除它們。複製xml文檔,不包括重複節點
我的文件看起來是這樣的:
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd id="ab" lang="en" version="1">
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd id="ab" lang="en" version="1">
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd id="cd" lang="en" version="1">
<title>Greatest Hits</title>
<artist>Dolly Parton</artist>
<country>USA</country>
<company>RCA</company>
<price>9.90</price>
<year>1982</year>
</cd>
<cd id="cd" lang="en" version="1">
<title>Still got the blues</title>
<artist>Gary Moore</artist>
<country>UK</country>
<company>Virgin records</company>
<price>10.20</price>
<year>1990</year>
</cd>
<cd id="de" lang="en" version="2">
<title>Eros</title>
<artist>Eros Ramazzotti</artist>
<country>EU</country>
<company>BMG</company>
<price>9.90</price>
<year>1997</year>
</cd>
</catalog>
所以它有一堆用相同的ID,版本和郎元素。我想要做的就是複製整個文檔,但每個節點只有一次...
我該怎麼做?備份?複製?換各個羣組?組合?
我想這樣的輸出:
<?xml version="1.0" encoding="UTF-8"?>
<catalog>
<cd id="ab" lang="en" version="1">
<title>Hide your heart</title>
<artist>Bonnie Tyler</artist>
<country>UK</country>
<company>CBS Records</company>
<price>9.90</price>
<year>1988</year>
</cd>
<cd id="cd" lang="en" version="1">
<title>Still got the blues</title>
<artist>Gary Moore</artist>
<country>UK</country>
<company>Virgin records</company>
<price>10.20</price>
<year>1990</year>
</cd>
<cd id="de" lang="en" version="2">
<title>Eros</title>
<artist>Eros Ramazzotti</artist>
<country>EU</country>
<company>BMG</company>
<price>9.90</price>
<year>1997</year>
</cd>
</catalog>
您使用的是XSLT 1.0還是2.0? –