XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 3rd, 2004, 01:21 PM
gunners11 gunners11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 gunners11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
XML Select boxes

Hi,
I know this is a really stupid question, but it would be the job if someone could help me.
All I want to do is take data like

<?xml version="1.0"?>
<?xml-stylesheet href="sharing.xsl" type="text/xsl"?>
<users>
<user name="Test User1" location="http://www.test1.com/~test1"/>
<user name="Test User2" location="http://www.test2.com/~test2"/>
</users>

and display it using an XSL stylesheet so that the name attributes are listed in a select box and the location attribute is linked to by that element. If that makes sense. Basically when you click on Test User1 you go to URL

Really appreciate it if anyone knows what to do.
Gunners11

Reply With Quote
  #2  
Old February 3rd, 2004, 01:47 PM
MattSidesinger's Avatar
MattSidesinger MattSidesinger is offline
Java PHP Oracle Developer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: C-Bus OH-IO
Posts: 204 MattSidesinger User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 26 sec
Reputation Power: 5
Send a message via AIM to MattSidesinger
Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

<xsl:template match="/">
<html>
	<head>
		<script>
			<![CDATA[
			function users_onChange(cboUsers)
			{
				location.href = cboUsers.value;
			}
			]]>
		</script>
	</head>
	<body>
		<xsl:call-template name="printUsersDropdown">
			<xsl:with-param name="usersNode" select="users"/>
		</xsl:call-template>
	</body>
</html>
</xsl:template>

<xsl:template name="printUsersDropdown">
	<xsl:param name="usersNode"/>

	<select id="users" onchange="users_onChange(this);">
		<option>Select a user ...</option>
		<xsl:for-each select="$usersNode/user">
			<option value="{@location}"><xsl:value-of select="@name"/></option>
		</xsl:for-each>
	</select>
	
</xsl:template>

</xsl:stylesheet>

Reply With Quote
  #3  
Old February 4th, 2004, 03:46 AM
gunners11 gunners11 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 2 gunners11 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thank You

Thanks for that MattSidesinger
Really Appreciate it, worked perfectly.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > XML Select boxes


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT