我有这个 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 标签显示在输出中。你能告诉我这是如何实现的吗?