473,322 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

XSLT: Creating partly expanded navigation menu from full hierarchy

I'm sure this is covered on the Web, but I can't figure out a
sufficiently narrow Google query: Suppose I have a hierarchical website
structure

Page 1
Page 1a
Page 1b
Page 1b1
Page 1b2
Page 1b3
Page 2
Page 2a
Page 2b
Page 2c
Page 3
Page 4
Page 4a
Page 4b

encapsulated in XML, where each node has an attribute called "item" and
one called "url". In a page on my web server (ASP, PHP, whatever) I have
a value that may match the item attribute belonging to one of my nodes.
This should allow me to display a navigation menu that shows only the
top-level items, except that every item that is an ancestor of the
current page or that IS the current page should be expanded. So if I'm
on page 1 or on page 1a, I should see the following items on the
navigation menu:

Page 1
Page 1a
Page 1b
Page 2
Page 3
Page 4

If I'm on page 1b or on any of its children, I should see

Page 1
Page 1a
Page 1b
Page 1b1
Page 1b2
Page 1b3
Page 2
Page 3
Page 4

If I'm on page 3 then I should only see:

Page 1
Page 2
Page 3
Page 4

One further detail: the item that matches the current page is the only
one that *shouldn't* be hyperlinked.

Can someone point me to an illustration of this?
Oct 12 '07 #1
1 2842
Harlan Messinger a écrit :
Can someone point me to an illustration of this?
Given your "context menu", and in a bottom-up approach, you want to
display the preceding siblings of its last ancestor, its ancestors, its
preceding siblings, it-self, its children (but not its other
descendants), its following siblings, then the following siblings of its
last ancestor. Many well-known XPath axes here ;-) and a subtility about
the definition of "last" ancestor...

Well, the best way to go is probably to use a top-down approach and to
process each menu recursively except if the menu isn't an ancestor of
the "context menu" or a sibling of its last ancestor, one if its
siblings (preceding and following, or, as a variant, a menu whose parent
it the same as the "context menu") or one of its children (but not its
descendants).
One further detail: the item that matches the current page is the only
one that *shouldn't* be hyperlinked.
You want a different processing if the processed "menu" is equal/not
equal to your "context menu".

Cheers,

p.b.

Oct 12 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a...
5
by: Don Garrett | last post by:
I have an XML document at the root of a directory tree that contains relative URIs to resources in a directory tree. During XSLT processing, these URI's can be used without any problems to...
1
by: Mark247 | last post by:
Hi, When transforming an XSLT to HTML I get a very annnoying white spac gap of about 2px under each image. This is particularly annoying as am creating a vertical navigation menu made up of images...
9
by: Harry | last post by:
I am accumulating over 80 pages per day into an archive that I will need to be able to present sequentially to viewers. Using html to viewing a page, then click on back to return to my archive...
1
by: cashdeskmac | last post by:
I am using VS2005 and creating a menu control. I have a script section in the control (and also in the page itself) which will show a certain set of submenus depending on a parameter passed in to...
2
by: sebastian.langer | last post by:
Hi! Certainly somebody had my problem before and could give me just some hints, how to solve it: I have an xml file, which contains scientific data in a tree form. The data should be changed...
7
by: Zzzbla | last post by:
Hi all, anyone has a live example of loading an xml file from a server, an xslt file from the server, then transforming the xml using the xslt and outputing the results (preferably with...
4
by: mark4asp | last post by:
I want to write a xslt template to create a xhtml 1.0 (transitional) file which will be sent in as email. Here is a typical xml data file: <BatchEmail> <Domain>www.myDomain.com</Domain>...
3
by: z1 | last post by:
hi- i am fooling around with soap and weather templates. for some reason either this if or select is failing. i am very new to xml and found this code at another site. i can show you the xml...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.