Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 16th, 2007, 09:08 AM
Authorized User
Points: 145, Level: 2
Points: 145, Level: 2 Points: 145, Level: 2 Points: 145, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2007
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic menus and content?

Hi dear folks!

I am curious of some of your impressions on the scenario to follow:

I'd like to have a stylesheet smart enough to have dynamicly generated menus (depending on how many are found in the xml file) and displaying their respective content.
In other words (or code):

The XML would look something like this:

Code:
<main>
  <menu title="Menu 1"> Content for menu 1</menu>
  <menu title="Menu 2"> Content for menu 2</menu>
  <menu title="Menu 3"> Content for menu 3</menu>
  <menu title="Menu 4"> Content for menu 4</menu>
</main>
The result I am after generated on the page would use the 'title' attributes values as the navigation menu titles (or links if you wish) each displaying their content in the same page - basically playing with <div> visibilities.

But the main idea is to make the style sheet smart enough to display how many <menu> items (with their respective content) there might be in the xml file.

Thanks gang!
Gabi.

Reply With Quote
  #2 (permalink)  
Old October 16th, 2007, 09:14 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

Hi

If you're just trying to generate dynamic menus then that's not really a XSLT question, you should search out from DHTML or javascript forum for help.

If however you have a problem actually using XSLT to transform the XML you mention then try mentioning the desired output, and what you've tried so far.


/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #3 (permalink)  
Old October 16th, 2007, 09:28 AM
Authorized User
Points: 145, Level: 2
Points: 145, Level: 2 Points: 145, Level: 2 Points: 145, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2007
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Well, thanks but it is very much a XSLT issue since it regards the nodes transformation and later playing with the visibility in the output.
As for trying I was going to do that after the members impressions that was very helpful in the past posts.

thank you,
Gabi.

Reply With Quote
  #4 (permalink)  
Old October 16th, 2007, 09:31 AM
samjudson's Avatar
Friend of Wrox
Points: 8,687, Level: 40
Points: 8,687, Level: 40 Points: 8,687, Level: 40 Points: 8,687, Level: 40
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2007
Location: Newcastle, , United Kingdom.
Posts: 2,128
Thanks: 1
Thanked 189 Times in 188 Posts
Default

We're not here to do your work for you - if you have a specific problem then we'll try and help, but without even knowing what you're trying to output its hard to guess.

/- Sam Judson : Wrox Technical Editor -/
Reply With Quote
  #5 (permalink)  
Old October 16th, 2007, 09:33 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

That's a fairly common scenario. Both ASP.NET and DotNetNuke do something similar, producing a menu from an XML source, as do many of our applications at work. One uses the XML twice, once for the map and once to build the actual content pages. Look at asp.net sitemap if you want some ideas on how to structure the XML.

--

Joe (Microsoft MVP - XML)
Reply With Quote
  #6 (permalink)  
Old October 16th, 2007, 09:54 AM
mhkay's Avatar
Wrox Author
Points: 18,438, Level: 59
Points: 18,438, Level: 59 Points: 18,438, Level: 59 Points: 18,438, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,954
Thanks: 0
Thanked 290 Times in 285 Posts
Default

Do you know what HTML you want to generate from this XML?

If you know what output you want your stylesheet to produce, then I can help you write the code. If you don't know, then I can't.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
Reply With Quote
  #7 (permalink)  
Old October 16th, 2007, 10:05 AM
Authorized User
Points: 145, Level: 2
Points: 145, Level: 2 Points: 145, Level: 2 Points: 145, Level: 2
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2007
Location: , , .
Posts: 33
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok - sorry if I was unclear.

The result I am trying to generate is a single page that has a navigation menu comprised of the 'title' attributes of each 'menu' child. So the page would look something like this:

menu 1 ----- menu 2 ---- menu 3 ---- menu 4

As you click on those menus, the content of each will be displayed underneath. But all this in one single page. And I thought that the best way is to use <div> (layers) and playing with the visibility. Something that I am doing here:

XML: http://mamaliga.com/onlinescheduling/os_3_months.xml

The style sheet is: http://mamaliga.com/onlinescheduling/os_3_months.xsl

There I have 3 menus for now (MAIN, CT and MRI), each being displayed (or hidden) using layers. The problem there (if you look in the stylesheet)is that I have each layer hard-coded for each afferent section in the xml file.

in other words there I have:

<CT>
[...]
</CT>

<MRI>
[...]
</MRI>

So my intention in the end is to tweak the stylesheet so that I don't need to hard-code it for each of those sections in the XML (the sections are only CT and MRI for now but there will be dynamic)...

Hope I made it clear enough...

Thanks gang!
GAbi.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Menus - Using multiple dropdown boxes Sebastiaan ASP.NET 1.0 and 1.1 Basics 1 April 18th, 2007 06:25 AM
Code Announcement: Ch3, Dynamic Drop Down Menus richard.york BOOK: CSS Instant Results 0 November 14th, 2006 10:57 AM
Dynamic List Content cyberddindia Classic ASP Basics 3 October 24th, 2006 10:29 AM
dynamic menus off odbc database sionsolo42069 ASP.NET 2.0 Professional 5 March 21st, 2006 12:33 AM
Dynamic Link Menus richard.york Javascript 8 July 7th, 2004 05:23 PM



All times are GMT -4. The time now is 12:35 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.