私はこのxmlファイルを持っています:
<Item Text="Reports" Navigateurl ="Reports/Default.aspx" Select="true">
<Group>
<Item Text="Customers" NavigateUrl="Reports/Customers/Default.aspx" Select="true">
<Group>
<Item Text="Customers" NavigateUrl="Reports/Customers/CustomerList.aspx"
Select="true" />
<Item Text="Customer Products"
NavigateUrl="Reports/Customers/CustomersProducts.aspx" Select="true" />
<Item Text="Customer Measurements"
NavigateUrl="Reports/Customers/CustomerLocationMeasurements.aspx" Select="true" />
<Item Text="Customer Groups" NavigateUrl="Reports/Customers/CustomerGroups.aspx"
Select="true"/>
<Item Text="Customer Outages" NavigateUrl="Reports/Customers/CustomerOutages.aspx"
Select="true" />
</Group>
</Item>
<Item Text="Rules" NavigateUrl="Reports/Rules/Default.aspx" Select="true" >
<Group>
<Item Text="Customer Product Rules"
NavigateUrl="Reports/Rules/CustomerProducts.aspx" Select="true"/>
<Item Text="Customer Product Rules Event Limits"
NavigateUrl="Reports/Rules/CustomerProductEventLimits.aspx" Select="true" />
<Item Text="Customer Product Rules Curtailable Days/Hours"
NavigateUrl="Reports/Rules/CustomerProductCurtailableDaysHours.aspx"
Select="true" />
</Group>
</Item>
</Group>
</Item>
したがって、このXPATH式を使用すると、
XmlDataSource XmlDataSource1 = new XmlDataSource();
XmlDataSource1.DataFile = "~/Menu.xml";
XmlDataSource1.XPath = "//Item[@Text ='Reports']/Group/Item
[@Select='true']
XmlDataSource1.DataBind();
SiteMap1.DataSource = XmlDataSource1;
私はこの出力を取得します:
Customers
Group
Customer Pages
Rules
Group
Rules Pages
ただし、出力にGroupタグを表示したくありません。これを実現する方法を教えてください。