Wrox Programmer Forums
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 25th, 2007, 08:20 AM
Friend of Wrox
Join Date: Jul 2006
Posts: 430
Thanks: 28
Thanked 5 Times in 5 Posts
Send a message via Yahoo to bonekrusher
Default Binding XML to a listbox

Hi I am having trouble binding some xml to a list box:

here is my XML:

<?xml version="1.0" encoding="UTF-8"?>
    <chapter chaptitle="ATA 21">
Here is my xslt:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
            <xsl:apply-templates select="chapter"/>
  <xsl:template match="chapter">
      <xsl:apply-templates select="title"/>
  <xsl:template match="title">
      <xsl:value-of select="."/>
here is my ASPX:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
        <asp:ListBox ID="ListBox1" runat="server" DataSourceID="XmlDataSource1" Height="210px"
            Width="386px"></asp:ListBox><asp:XmlDataSource ID="XmlDataSource1" runat="server"
                DataFile="~/masterfiles.xml" TransformFile="~/test.xslt" XPath="manual/chapter/title/node()">

How do I display the innertext of the XML in the list box? what would be the correct XPATH?

for example:



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with binding XMl data into nested repeater vishnu108mishra XML 0 November 19th, 2007 03:53 AM
ch02 - Binding to a Simple XML Document Tophat BOOK: Beginning ASP.NET 1.0 7 August 17th, 2007 05:09 AM
binding on listbox in datagrid sunil131 VB Databases Basics 0 April 29th, 2007 06:11 AM
XML into Listbox rahimzai XML 0 November 22nd, 2006 08:17 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.