是否可以使用XSLT填充數據。我已經搜索並找不到任何有用的東西。使用XSLT「填充」數據
爲了說明,我收到了一些這樣的XML:
<?xml version="1.0" encoding="UTF-8"?>
<Root>
<Record>
<CompanyName>A</CompanyName>
<ContactSurname>A</ContactSurname>
<ContactFirstname>E</ContactFirstname>
<Address>Address 1</Address>
</Record>
<Record>
<Address>Address 2</Address>
</Record>
<Record>
<Address>Address 3</Address>
</Record>
<Record>
<CompanyName>B</CompanyName>
<ContactSurname>B</ContactSurname>
<ContactFirstname>A</ContactFirstname>
<Address>Address 4</Address>
</Record>
<Record>
<Address>Address 5</Address>
</Record>
....
我需要做的是改變不包含所有元素添加它們因此輸出將是每個記錄。
<?xml version="1.0" encoding="UTF-8"?>
<Root>
<Record>
<CompanyName>A</CompanyName>
<ContactSurname>A</ContactSurname>
<ContactFirstname>E</ContactFirstname>
<Address>Address 1</Address>
</Record>
<Record>
<CompanyName>A</CompanyName>
<ContactSurname>A</ContactSurname>
<ContactFirstname>E</ContactFirstname>
<Address>Address 2</Address>
</Record>
<Record>
<CompanyName>A</CompanyName>
<ContactSurname>A</ContactSurname>
<ContactFirstname>E</ContactFirstname>
<Address>Address 3</Address>
</Record>
<Record>
<CompanyName>B</CompanyName>
<ContactSurname>B</ContactSurname>
<ContactFirstname>A</ContactFirstname>
<Address>Address 4</Address>
</Record>
<Record>
<CompanyName>B</CompanyName>
<ContactSurname>B</ContactSurname>
<ContactFirstname>A</ContactFirstname>
<Address>Address 5</Address>
</Record>
....
我可以輕鬆地使用.NET通過記錄進行迭代,並創建一個新的XML文件,但我認爲它可能是更快,更簡單的做這樣如果有可能。
http://stackoverflow.com/help/someone-answers –