Hi I am having trouble binding some xml to a list box:
here is my XML:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manual>
<chapter chaptitle="ATA 21">
<title>21-01-01.xml</title>
<title>21-01-A.xml</title>
<title>21-01-B.xml</title>
<title>21-02-01.xml</title>
</chapter>
</manual>
Here is my xslt:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<manual>
<xsl:apply-templates select="chapter"/>
</manual>
</xsl:template>
<xsl:template match="chapter">
<chapter>
<xsl:apply-templates select="title"/>
</chapter>
</xsl:template>
<xsl:template match="title">
<title>
<xsl:value-of select="."/>
</title>
</xsl:template>
</xsl:stylesheet>
here is my ASPX:
Code:
<%@ 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>
</head>
<body>
<form id="form1" runat="server">
<div>
<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()">
</asp:XmlDataSource>
</div>
</form>
</body>
</html>
How do I display the innertext of the XML in the list box? what would be the correct XPATH?
for example:
21-01-01.xml
21-01-A.xml
21-01-B.xml
21-02-01.xml
Thanks