-1
我是xslt的新手,我很難弄清楚如何轉換下面的xml。我知道我必須遍歷行,但我不知道如何將列名轉換爲元素。任何幫助將不勝感激。如何使用xslt在xml中轉換數據集
這是從web服務
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<xmlns="http://www.someservice.com/webservices/">
<GetResultsResult>
<Columns>
<WSColumn>
<Name>triptype</Name>
</WSColumn>
<WSColumn>
<Name>description</Name>
</WSColumn>
<WSColumn>
<Name>id</Name>
</WSColumn>
</Columns>
<Rows>
<WSRow>
<Cell>
<anyType xsi:type="xsd:string">vacation</anyType>
<anyType xsi:type="xsd:string">Trip to Bahamas</anyType>
<anyType xsi:type="xsd:int">89</anyType>
</Cell>
</WSRow>
<WSRow>
<Cell>
<anyType xsi:type="xsd:string">vacation</anyType>
<anyType xsi:type="xsd:string">Trip to California</anyType>
<anyType xsi:type="xsd:int">75</anyType>
</Cell>
</WSRow>
<WSRow>
<Cell>
<anyType xsi:type="xsd:string">business</anyType>
<anyType xsi:type="xsd:string">Trip to Chicago</anyType>
<anyType xsi:type="xsd:int">82</anyType>
</Cell>
</WSRow>
</Rows>
<HasErrors>false</HasErrors>
<ErrorMessage />
</GetResultsResult>
</GetResultsResponse>
</soap:Body>
</soap:Envelope>
這收到的XML是改造後期望的結果
<Trips>
<Trip>
<triptype>vacation</triptype>
<description>Trip to Bahamas</description>
<id>89</id>
</Trip>
<Trip>
<triptype>vacation</triptype>
<description>Trip to California</description>
<id>75</id>
</Trip>
<Trip>
<triptype>business</triptype>
<description>Trip to Bahamas</description>
<id>82</id>
</Trip>
</Trips>
預先感謝您! 馬塞洛
JLRishe,謝謝你這麼多答案!!!這正是我正在尋找的... – mcampos 2013-03-18 21:02:22