Xpath Help!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shiznit
    New Member
    • Nov 2007
    • 8

    Xpath Help!

    In ASP i used XMLDataSource to create a small menu. For the following xml how would i get just the @nav value and create a small navigation menu like this:

    Menu architecture: exhibition publication review

    So far i have this:

    Code:
    <asp:XmlDataSource id="MySource" DataFile='architecture.xml' XPath='/architecture' runat="server"/>
    
    <div id="nav">Menu
    		<asp:Repeater id="xml" DataSourceId="MySource" runat="server">
    		<ItemTemplate><h1><%# XPath("@fullname")%>: </h1>
    				<asp:Repeater id="nav" DataSource='<%# XPathSelect("@nav") %>' runat="server">
    				<ItemTemplate>   
    					<a href="#"><%# XPath(".")%></a>
    				</ItemTemplate>
    				</asp:Repeater>
    		</ItemTemplate>
    		</asp:Repeater>
    </div>
    
    
    
    [architecture.xml]
    <?xml version="1.0" encoding="iso-8859-1"?>
    <architecture fullname="architecture">
    	<exhibition nav="exhibition">
    	</exhibition>
    	
    	<publications nav="publication">
    	</publications>
    	
    	<images nav="image">
    	</images>
    	
    	<reviews nav="review">
    	</reviews>
    </architecture>
    Thanks for your help!!
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    Why not image as well? Is there a list of the ones that you do display?

    xpath could be:
    //*/@nav

    Comment

    • shiznit
      New Member
      • Nov 2007
      • 8

      #3
      sorry yea including image, and yes it worked! Thanks for your help!

      Comment

      Working...