473,466 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Create menu using xml and xslt

Hi all,

i have managed to create an asp.net menu using xml and xslt.. i am now
trying to highlite the selected path by sending in the path info and
hilite it using an xsl select choose function. My only problem now is
to highlight all parent nodes above the one selected. Does anyone have
any ideas as to achieve this..

XML DATA
.................................................. ........
<?xml version="1.0" ?>
<MenuData>
NEEDS TO BE HIGHLIGHTED <MenuGroup Menu="True" ID="About"
Label="About" URL="/1/about/" Image="about_thumb.jpg" Text="A history
of our its origins and pedigree">
FOUND AND HIGHLIGHTED <MenuItem Box="True" ID="About1"
Label="Introduction" URL="/1/about/introduction.aspx"
Image="about_intro_thumb.jpg" Text="A brief outline of the Group and
its composite parts"/>
</MenuGroup>
<MenuData>
...............................................
xslt:
-----------------------------------------------------
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="sectionID" />
<xsl:param name="urlID" />
<xsl:template match="/MenuData/MenuGroup">
<xsl:if test="@ID=$sectionID">
<div class="divHeaderBlue">Sub Menu</div>
<div class="link-list">
<ul class="light">
<xsl:for-each select="MenuItem">
<xsl:choose>
<xsl:when test="@URL=$urlID">
<li class="blue">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@URL" />
</xsl:attribute>
<xsl:value-of select="@Label" />
</a>
</li>
</xsl:when>
<xsl:otherwise>
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="@URL" />
</xsl:attribute>
<xsl:value-of select="@Label" />
</a>
</li>
</xsl:otherwise>
</xsl:choose>

</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Nov 19 '05 #1
2 2703
HI Anhtony ..
Try looking at http://www.skmmenu.com
U can find such Menu's there..
Enjoy
Patrick

"Anthony" wrote:
Hi all,

i have managed to create an asp.net menu using xml and xslt.. i am now
trying to highlite the selected path by sending in the path info and
hilite it using an xsl select choose function. My only problem now is
to highlight all parent nodes above the one selected. Does anyone have
any ideas as to achieve this..

XML DATA
.................................................. ........
<?xml version="1.0" ?>
<MenuData>
NEEDS TO BE HIGHLIGHTED <MenuGroup Menu="True" ID="About"
Label="About" URL="/1/about/" Image="about_thumb.jpg" Text="A history
of our its origins and pedigree">
FOUND AND HIGHLIGHTED <MenuItem Box="True" ID="About1"
Label="Introduction" URL="/1/about/introduction.aspx"
Image="about_intro_thumb.jpg" Text="A brief outline of the Group and
its composite parts"/>
</MenuGroup>
<MenuData>
...............................................
xslt:
-----------------------------------------------------
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="sectionID" />
<xsl:param name="urlID" />
<xsl:template match="/MenuData/MenuGroup">
<xsl:if test="@ID=$sectionID">
<div class="divHeaderBlue">Sub Menu</div>
<div class="link-list">
<ul class="light">
<xsl:for-each select="MenuItem">
<xsl:choose>
<xsl:when test="@URL=$urlID">
<li class="blue">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@URL" />
</xsl:attribute>
<xsl:value-of select="@Label" />
</a>
</li>
</xsl:when>
<xsl:otherwise>
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="@URL" />
</xsl:attribute>
<xsl:value-of select="@Label" />
</a>
</li>
</xsl:otherwise>
</xsl:choose>

</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Nov 19 '05 #2
Hi Anthony,

You could try Telerik's menu system (at www.telerik.com) - a working
example of what you are looking at is here:

http://www.telerik.com/r.a.d.menu/de...ality/ShowPath

This sort of functionality in the menu system you've already built might
be a bit tricky. You could, for example, use a recursive function to iterate
through the parent node of each node and change it's style.

Something like:

function SetParentPath(MyNode as Node)
MyNode.Highlighted = true
if not MyNode.ParentNode is nothing then
SetParentPath(MyNode.ParentNode)
end if
end function

Telerik's RAD menu has this built in I think - but if it didn't then you
could easily implement a function like this. In your context you will need
to expose a property on each node object that you've written called
Highlighted - which changes the style etc.

Is this any help?

Regards,

Nick
"Anthony" <an***********@hotmail.com> wrote in message
news:77**************************@posting.google.c om...
Hi all,

i have managed to create an asp.net menu using xml and xslt.. i am now
trying to highlite the selected path by sending in the path info and
hilite it using an xsl select choose function. My only problem now is
to highlight all parent nodes above the one selected. Does anyone have
any ideas as to achieve this..

XML DATA
.................................................. .......
<?xml version="1.0" ?>
<MenuData>
NEEDS TO BE HIGHLIGHTED <MenuGroup Menu="True" ID="About"
Label="About" URL="/1/about/" Image="about_thumb.jpg" Text="A history
of our its origins and pedigree">
FOUND AND HIGHLIGHTED <MenuItem Box="True" ID="About1"
Label="Introduction" URL="/1/about/introduction.aspx"
Image="about_intro_thumb.jpg" Text="A brief outline of the Group and
its composite parts"/>
</MenuGroup>
<MenuData>
..............................................
xslt:
-----------------------------------------------------
<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:param name="sectionID" />
<xsl:param name="urlID" />
<xsl:template match="/MenuData/MenuGroup">
<xsl:if test="@ID=$sectionID">
<div class="divHeaderBlue">Sub Menu</div>
<div class="link-list">
<ul class="light">
<xsl:for-each select="MenuItem">
<xsl:choose>
<xsl:when test="@URL=$urlID">
<li class="blue">
<a>
<xsl:attribute name="href">
<xsl:value-of select="@URL" />
</xsl:attribute>
<xsl:value-of select="@Label" />
</a>
</li>
</xsl:when>
<xsl:otherwise>
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="@URL" />
</xsl:attribute>
<xsl:value-of select="@Label" />
</a>
</li>
</xsl:otherwise>
</xsl:choose>

</xsl:for-each>
</ul>
</div>
</xsl:if>
</xsl:template>
</xsl:stylesheet>

Nov 19 '05 #3

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

Similar topics

8
by: Raymond H. | last post by:
Hello, 1- How to see, in a Label, the URL of a link that the mouse pass over? (in the WebBrower control in a vb projet). 2- How to create a menu and a submenu via a button Command1? and...
7
by: Rolf Kemper | last post by:
Dear All, somehow I remember that such or similar question was discussed already somewhere. But I can't find it anymore. I have a template calling itself. As long it goes deeper into the...
0
by: Adam Retter | last post by:
Hi Guys, I have a need to create a html form based on my schema. I initially decided to do this using xql, have got some way but am finding this difficult (it may be as I am very new to xql)....
3
by: IMS.Rushikesh | last post by:
Hi Friends, I need a XPath query, whcih ll return me subset of data.... check below xml stream <label id="MyExpenseDetails_lbl" xlink:role="terseLabel">Short Expense Details</label> <label...
0
by: canasdaq | last post by:
Can anyone please help me. I was looking at the article "http://www.eggheadcafe.com/articles/20030603.asp". I am new to .net and know nothing in c#. I want to write a menu in asp.net. Can anyone...
7
by: pintihar | last post by:
Hi, As a follow on from an earlier post I have another question about xslt. Is it possible to create the stylsheet programatically? Is this sensible? In the first phase I needed to map element...
6
by: Martin | last post by:
Hi, I have a xml file like the one below <?xml version="1.0" encoding="utf-8"?><e1 xmlns:e1="http://tempuri.org/Source1.xsd" e1:att1="1" e1:att2="2" e1:rest="345"/> If I try to create a...
1
by: mondenkind | last post by:
Hi folks, I have the following problem and maybe someone give me a hint how to solve it: I have an .xml file that contains a menu / tree structure which i transform with XSLT and JavaScript to a...
1
by: Harlan Messinger | last post by:
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.