Can anyone tell me how I can dynamically (notice there can be X categories) get the Categories/Category[X] node extracted from this XML? If possible can you show 1 line for each category and another way to concatenate them all into one single label control. Thank you to any and everyone with anything to add.
Code here...
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="YahooLocalSearchInDataListControl.aspx.cs" Inherits="YahooPlayGround.YahooLocalSearchInDataListControl" %>
<!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 id="Head1" runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="http://local.yahooapis.com/LocalSearchService/V3/localSearch?appid=YahooDemo&query=special%20education&zip=15201&results=20"
XPath="/ResultSet/Result" TransformFile="~/RemoveNameSpaces.xslt"></asp:XmlDataSource>
<br />
<aspataList ID="DataList1" runat="server" DataSourceID="XmlDataSource1">
<ItemTemplate>
<b><asp:Label runat="server" ID="Company" Text='<%# XPath("Title") %>'></asp:Label></b><br />
<asp:Label runat="server" ID="Address" Text='<%# XPath("Address") %>'></asp:Label>
<asp:Label runat="server" ID="City" Text='<%# XPath("City") %>'></asp:Label>
<asp:Label runat="server" ID="State" Text='<%# XPath("State") %>'></asp:Label>
<asp:Label runat="server" ID="Phone" Text='<%# XPath("Phone") %>'></asp:Label>
<asp:Label runat="server" ID="Categories" Text='<%# XPath("Categories/Category[1]")%>'></asp:Label>
<br />
<br />
</ItemTemplate>
</aspataList>
</form>
</body>
</html>
XML here...
http://local.yahooapis.com/LocalSear...201&results=20
XSL here....(courtesy of http://www.intrepidstudios.com/blog/...amespaces.aspx)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslutput method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="*">
<!-- Remove any prefixes -->
<xsl:element name="{local-name()}">
<!-- Work through attributes -->
<xsl:for-each select="@*">
<!-- Remove any attribute prefixes -->
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:for-each>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>