我是 xslt 的新手,我很难弄清楚如何转换以下 xml。我知道我必须遍历行,但我不知道如何将列名转换为元素。任何帮助将不胜感激。
这是从 webservice 收到的 xml
<?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>
这是改造后想要的结果
<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>
先感谢您!!!马塞洛