Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 16th, 2007, 09:08 AM
Authorized User
 
Join Date: Mar 2007
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.

 
Old October 16th, 2007, 09:14 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
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 -/
 
Old October 16th, 2007, 09:28 AM
Authorized User
 
Join Date: Mar 2007
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.

 
Old October 16th, 2007, 09:31 AM
samjudson's Avatar
Friend of Wrox
 
Join Date: Aug 2007
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 -/
 
Old October 16th, 2007, 09:33 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
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)
 
Old October 16th, 2007, 09:54 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 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
 
Old October 16th, 2007, 10:05 AM
Authorized User
 
Join Date: Mar 2007
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.






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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.