How can I filter xml data with xpath?

freeadulru

New Member
If I have a xml file with something like this:\[code\] <?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>\[/code\]And then the data is being displayed in a repeater like so:\[code\]<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>\[/code\]How could I display only the Employee in the Sales department? This is in a asp.net webapp.
 
Back
Top