商品詳細ページのメニュー ナビゲーションを構築しようとしていますが、同じカテゴリにある商品のナビゲーション アイテムのみを表示したいと考えています。
データは 2 つの異なる XML ファイルで維持されます。1 つは現在の製品データを含み、もう 1 つはナビゲーション情報を含みます。どちらも「カテゴリ」を要素として含んでいます。
別の XmlDataSource を使用し、XPath("category") を使用してアクセスできる親コンテナーから現在の製品カテゴリを XPath 属性に渡して、値をフィルター処理したいと考えています。
次に、このフィルター処理されたデータ ソースをリピーターに渡してレンダリングします。
<%-- get the current product XML --%>
<asp:XmlDataSource ID="productDS" runat="server" XPath="/product" DataFile="~/App_Theme/project/products/poduct1.xml"/>
<asp:DataList ID="product" DataSourceID="productDS" runat="server">
<ItemTemplate>
<%--
get the navigation XML and filter the nodes to only show the navItems with the current product category
--%>
<asp:XmlDataSource ID="navItemsDS" runat="server" XPath="/navigation/navItems/navItem[category='<%# XPath("category") %>']" DataFile="~/App_Theme/project/productslist.xml"/>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="navItemsDS" >
<HeaderTemplate>
<ul>
</HeaderTemplate>
<ItemTemplate>
<li><a href="productdetail.html?page=products&id=<%# XPath("prodctid") %>"><%# XPath("producttitle") %></a></li>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
... etc
ただし、これは機能しません。
.NET 2.0 でこれを実現するにはどうすればよいですか。