Hello,
I have the following XML:
<?xml version="1.0" encoding="utf-8" ?>
<ApplicationSettingCategories>
<Category>Cat1</Category>
<Category>Cat2</Category>
<Category>Cat3</Category>
<Category>Cat4</Category>
<Category>Cat5</Category>
<Category>Cat6</Category>
</ApplicationSettingCategories>
I am trying to bind this Xml to a Dropdownlist in ASP.net using an XmlDataSource and Xslt. This is my first time doing this. The Dropdownlist shows the correct number of blank items, leading me to believe the iteration is working but the Values and Text are blank.
Any help in identifying my error would be appreciated.
Thanks
My XLST
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="xml" indent="yes"/>
<xsl:template match="ApplicationSettingCategories">
<Categories>
<xsl:apply-templates select="Category"/>
</Categories>
</xsl:template>
<xsl:template match="Category">
<Category>
<xsl:attribute name="Category">
<xsl:value-of select="Category"/>
</xsl:attribute>
</Category>
</xsl:template>
My ASPX
<asp:DropDownList ID="ddl1" runat="server" DataSourceID="XmlDataSource1"
DataTextField="Category" DataValueField="Category" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/App_Data/Xml/SettingCategory.xml"
TransformFile="~/Schema/AppCategoryXSLT.xslt"></asp:XmlDataSource>
My Source View
<select name="ddl1" id="ddl1">
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
<option value=""></option>
</select>