XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 5th, 2004, 08:49 AM
1ei1a 1ei1a is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 32 1ei1a User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 28 m 13 sec
Reputation Power: 5
Angry selecting a node based on element value

Folks,

I keep getting stuck! Perhaps someone could help me with this question.

Below is a copy of my xml document. As you can see, I have main navigation nodes (navItem), and sub navigation nodes(sub).

I want to be able to select a node based on the @href element.

So, for example, a user may click on http://mysite/Strategy.aspx, and my code will work out what page it's on and display the @breadcrumb for that specific node (in this case (Strategy)). Another example, is a user may go deeper into my site by clicking on http://mysite//Strategy/BusinessDirection.aspx. I want @breadCrumb to display as Strategy / Business Direction.

As you can see both nodes are on different levels, but they have the same elements. Is there a way to select the correct element regardless of node level??


<siteNavigation>
<navItem title="Strategy" href="/Strategy.aspx" breadCrumb="Strategy">
<sub title="Business Direction" href="/Strategy/BusinessDirection.aspx" breadCrumb="Strategy / Business Direction"/>
<sub title="Business Themes" href="/Strategy/BusinessThemes.aspx" breadCrumb="Business Themes / Business Themes"/>
</navItem>
<navItem title="Organisation" href="/Organisation.aspx" breadCrumb="Organisation">
<sub title="Business Groups" href="/Organisation/BusinessGroups.aspx" breadCrumb="Organisation / Business Groups"/>
<sub title="Segments" href="/Organisation/Segments.aspx" breadCrumb="Organisation / Segments"/>
<sub title="Org Charts" href="/Organisation/OrgCharts.aspx" breadCrumb="Organisation / Org Charts"/>
</navItem>
<navItem title="People and Values" href="/PeopleAndValues.aspx" breadCrumb="People and Values">
<sub title="Our Values" href="/PeopleAndValues/OurValues.aspx" breadCrumb="Strategy / Our Values"/>
<sub title="Career Development and People Strategy" href="/PeopleAndValues/CDAPS.aspx" breadCrumb="Business Themes / Career Development and People Strategy"/>
</navItem>
<navItem title="Making it Happen" href="/MakingItHappen.aspx" breadCrumb="Making it Happen">
<sub title="Best Practices" href="/MakingItHappen/BestPractices.aspx" breadCrumb="Strategy / Best Practices"/>
<sub title="Case Studies / Customer Successes" href="/MakingItHappen/CaseStudies.aspx" breadCrumb="Business Themes / Case Studies / Customer Successes"/>
<sub title="Activities and Events" href="/MakingItHappen/Activities.aspx" breadCrumb="Strategy / Activities and Events"/>
</navItem>
</siteNavigation>

Reply With Quote
  #2  
Old August 5th, 2004, 09:23 AM
1ei1a 1ei1a is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 32 1ei1a User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 28 m 13 sec
Reputation Power: 5
Talking

Found the answer: for anyone who's interested here's a snippet from my xslt:

<xsl:template match="siteNavigation">
<xsl:for-each select="navItem/."><xsl:if test="@href=$queryString" >
<table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<td class="border" colspan="2"><img src="/images/1ptrans.gif"/></td>
</tr>
<tr>
<td class="breadcrumb"><img src="/images/1ptrans.gif" height="21" width="20"/></td>
<td class="breadcrumb" width="100%"><strong>You are here: </strong>mysite / <strong><xsl:value-of select="@breadCrumb" /></strong></td>
</tr>
<tr>
<td class="borderDark" colspan="2"><img src="/images/1ptrans.gif"/></td>
</tr>
</table>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > selecting a node based on element value


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT