[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Retrieving top section from a navigation tree

Subject: Retrieving top section from a navigation tree
From: "Mario Caprino" <mariocaprino@xxxxxxxxxxx>
Date: Wed, 27 Oct 2004 18:30:20 +0200
mario caprino
Hi,

I have a navigation tree and would like to find out which main navigation section I am located underneath when i have the unique id of the page I am viewing.

Here's an example tree;
<xsl:variable name="ul">
<ul id="menu">
<li id="1">one</li>
<li id="2">two
 <ul>
  <li id="2-1">two-one</li>
  <li id="2-2">two-two
   <ul>
    <li id="2-2-1">two-two-one</li>
   </ul>
  </li>
 </ul>
</li>
<li id="3">three</li>
</ul>
</xsl:variable>

<xsl:variable name="id" select=="'2-2-1'" />

Say I am viewing the page "2-2-1", I would now like to write an xpath expression that retrieves the name (text element) of the containing top li element. In this case the name would be "two".

I have tried to look at the problem from differen perspectives;
- one is to find the top <li> elements and filter out any that does not contain an <li> element that matches the page $id
- the other is to find the <li> element with the specific @id, and traverse outwards to find the containing top <li> element


Sadly I do not understand how I would retrieve the name "two" using any of these methods.

My failed xpath expression so far looks like this;
exsl:node-set($ul)/ul[@id='menu']/li[//li/@id=$id]/text()

Thank you for your help.

Best regards,
Mario Caprino

_________________________________________________________________
MSN Messenger http://www.msn.no/computing/messenger Den raskeste veien mellom deg og dine venner


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.