如果我有一个这样的 xml 文件:
<?xml version="1.0" encoding="utf-8" ?>
<Employees>
<Employee Department="Sales">
<Name>David</Name>
<Salary>20000</Salary>
</Employee>
<Employee Department="Finance">
<Name>Simon</Name>
<Salary>18000</Salary>
</Employee>
<Employee Department="Accounts">
<Name>Peter</Name>
<Salary>22000</Salary>
</Employee>
</Employees>
然后数据显示在转发器中,如下所示:
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="XmlDataSource1">
<ItemTemplate>
<strong>
<%# XPath("@Department")%><br />
</strong>
- Name: <%#XPath("Name")%><br />
- Salary: <%#XPath("Salary")%><br />
</ItemTemplate>
</asp:Repeater>
我怎样才能只显示销售部门的员工?这是在一个 asp.net webapp 中。