views:

13

answers:

0

Hi!

I need to sort and choose only the last 5 inputs to my xml, Ill give you an idea of how my xml looks like.

<News>
  <Article>
    <Headline>First</Headline>
    <Content>First</Content>
    <ID>1</ID>
  </Article>
  <Article>
    <Headline>Second</Headline>
    <Content>Second</Content>
    <ID>2</ID>
  </Article>
</News>

And im binding this to a repeater

    Dim doc As XmlDocument = New XmlDocument()
    doc.Load(Server.MapPath("News.xml"))


    Dim nodes As XmlNodeList = doc.SelectNodes("News/Article")
    RptTable.DataSource = nodes
    RptTable.DataBind()

In aspx

    <asp:Repeater ID="RptTable" runat="server">
    <ItemTemplate>
    <div style="width:295px">
     <%#Container.DataItem("Headline").innertext%>
    </div>
    <br />
    <div style="width:295px">
     <%#Container.DataItem("Content").innertext%>
    </div>
    <br />
    <hr />
    <br />
    </ItemTemplate>
    </asp:Repeater>

The problem is that i get ALL the records, say if i only want the 5 last entries.. What do i need to do? There must be some sort of sorting function to aid?