distinct data from XML using XSL
Hi
I have an XML file which I am trying to view in a drop down list, basically I want the drop down list on an ASP.net page to select only distinct values from an element, example:
<BANKS>
<Bank>
<bank>BANK1</bank>
<branch>city1 </branch>
<address1> </address1>
</Bank>
<Bank>
<bank> BANK1</bank>
<branch>city </branch>
<address1>home </address1>
</Bank>
<Bank>
<bank> BANK2</bank>
<branch>city </branch>
<address1>home </address1>
</Bank>
</BANKS>
So basically I want my drop down list to provide me with the following options:
BANK1
BANK2
I have the following in an XSL file, but itâs still not working:
<xsl:for-each select="/Banks/Bank[not(bank = preceding-sibling::Bank/bank)]">
<xsl:sort select="bank" data-type="text" order="ascending"/>
<xsl:value-of select="bank"/>
</xsl:for-each>
Aspx:
<asp:DropDownList ID="ddl_Banks" runat="server" DataSourceID="XmlDataSource1"
DataTextField="bank" DataValueField="nsc" Width="184px" ></asp:DropDownList>
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/Banks.xml" TransformFile="~/Banks.xsl"></asp:XmlDataSource>
Any ideas?
__________________
Thank You
|