我有一個從SQL表中生成的XML文件。我需要將XML轉換爲我需要的輸出XML。需要幫助來創建XSLT
輸入XML:
<rowset>
<row>
<aaa>123</aaa>
<bbb>James</bbb>
<ddd>Large</ddd>
<eee>Black</eee>
<ddd>456213</ddd>
</row>
<row>
<aaa>123</aaa>
<bbb>James</bbb>
<ddd>Large</ddd>
<eee>Blue</eee>
<ddd>456213</ddd>
</row>
<row>
<aaa>123</aaa>
<bbb>James</bbb>
<ddd>small</ddd>
<eee>Black</eee>
<ddd>456213</ddd>
</row>
<row>
<aaa>123</aaa>
<bbb>James</bbb>
<ddd>small</ddd>
<eee>blue</eee>
<ddd>456213</ddd>
</row>
<row>
<aaa>321</aaa>
<bbb>William</bbb>
<ddd>Large</ddd>
<eee>White</eee>
<ddd>555555</ddd>
</row>
<row>
<aaa>321</aaa>
<bbb>William</bbb>
<ddd>Large</ddd>
<eee>Yellow</eee>
<ddd>555555</ddd>
</row>
<row>
<aaa>321</aaa>
<bbb>William</bbb>
<ddd>small</ddd>
<eee>White</eee>
<ddd>555555</ddd>
</row>
<row>
<aaa>321</aaa>
<bbb>William</bbb>
<ddd>small</ddd>
<eee>Yellow</eee>
<ddd>555555</ddd>
</row>
</rowset>
輸出XML:
<?xml version="1.0" encoding="utf-8"?>
<tXML xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:user="urn:my-scripts">
<product product-id = "123">
<Name>James</Name>
<Image>
<Image image-view-type = "Large" image-color = "Black">
<Image image-view-type = "Large" image-color = "Blue">
<Image image-view-type = "small" image-color = "Black">
<Image image-view-type = "small" image-color = "Blue">
</Image>
<DeptCode>456213</DeptCode>
</product>
<product product-id = "321">
<Name>William</Name>
<Image>
<Image image-view-type = "Large" image-color = "White">
<Image image-view-type = "Large" image-color = "Yellow">
<Image image-view-type = "small" image-color = "White">
<Image image-view-type = "small" image-color = "Yellow">
</Image>
<DeptCode>555555</DeptCode>
</product>
</tXML>
如何編寫XSLT這一點。 請注意產品很多。所以會有成千上萬的產品。
您使用的是哪個版本的XSLT? –