|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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> |
|
#2
|
|||
|
|||
|
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> |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > selecting a node based on element value |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|