Go Back   CodingForums.com > :: Client side development > XML

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-05-2002, 08:22 PM   PM User | #1
thinguy
New to the CF scene

 
Join Date: Sep 2002
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
thinguy is an unknown quantity at this point
populate a drop down from another xml file

I'm wanting to populate a dropdown list of departments since the list is long and may change I'd like the list to be in another file rather than the main xml file. Below is the current xml code but I'd like to replace the "options" with data from the other file.

Any help would be great thanks.

<xsl:template name="SV_departmentnameEditTD"> <td class="ValueText">
<input type="hidden" name="{name}" id="{name}">
<xsl:attribute name="value"><![CDATA[<undefined><nochange>
</nochange></undefined>]]></xsl:attribute>
<select size="1" class="inputTextBox" name="_SV_CTRL_{name}" value="{value}" onchange="updateSvXml('document.forms[0]._SV_CTRL_{name}')">
<option value="{value}"> <xsl:value-of select="value"/> </option>
<option value="dep1">dep1</option>
<option value="dep2">dep2</option>
<option value="dep3">dep3</option>
<option value="dep4">dep4</option>
</select>
</td>

Last edited by thinguy; 11-05-2002 at 09:04 PM..
thinguy is offline   Reply With Quote
Old 11-05-2002, 08:44 PM   PM User | #2
WA
Administrator


 
Join Date: Mar 2002
Posts: 2,596
Thanks: 2
Thanked 19 Times in 18 Posts
WA will become famous soon enough
thinguy, I think you forgot the actual code. Please edit your post above to include this info. BTW, depending on how this thread evolves, this question might be better suited in the JavaScript Programming forum. Anyhow, first thing's first...
__________________
- George
- JavaScript Kit- JavaScript tutorials and 400+ scripts!
- JavaScript Reference- JavaScript reference you can relate to.
WA is offline   Reply With Quote
Old 11-11-2002, 06:41 PM   PM User | #3
thinguy
New to the CF scene

 
Join Date: Sep 2002
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
thinguy is an unknown quantity at this point
Anyone?

Anyone have any insight on this?

Thanks
thinguy is offline   Reply With Quote
Old 11-11-2002, 06:56 PM   PM User | #4
jkd
Senior Coder

 
jkd's Avatar
 
Join Date: May 2002
Location: metro DC
Posts: 3,163
Thanks: 1
Thanked 18 Times in 18 Posts
jkd will become famous soon enough
Here is a transform I used to import data from other XML documents and produce an XHTML statistics page. It should at least provide a start:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
	<xsl:variable name="ismall" select="document('../xml/individual-small.xml')"/>
	<xsl:variable name="ilarge" select="document('../xml/individual-large.xml')"/>
	<xsl:variable name="imssm"  select="document('../xml/individual-mssm.xml')" />
	<xsl:variable name="tsmall" select="document('../xml/team-small.xml')"      />
	<xsl:variable name="tlarge" select="document('../xml/team-large.xml')"      />
	<xsl:variable name="tmssm"  select="document('../xml/team-mssm.xml')"       />
	<xsl:output method="html"/>
	<xsl:template match="/">
		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
			<head>
				<title>AML Statistics</title>
				<style type="text/css">
					body {
						font: 1em Arial,Helvetica,sans-serif;
					}
					th {
						text-align: left;
					}
					td {
						padding: 2px 40px 2px 40px;
					}
				</style>
			</head>
			<body>
				<table>
					<tbody>
						<tr>
							<th colspan="4" style="text-align: center;">League stats:</th>
						</tr>
						<tr><td><br/></td></tr>
						<tr>
							<th>Completed meets</th>
							<td><xsl:value-of select="count($ismall//student[position()=1]/meets/meet)"/>/5</td>
							<th>Total students</th>
							<td><xsl:value-of select="count($ismall//student) + count($ilarge//student) + count($imssm//student)"/></td>
						</tr>
						<tr><td><br/></td></tr>
						<tr>
							<th>Students attending 5/5</th>
							<td><xsl:value-of select="count($ismall//student[count(meets/meet[@absent]) = 0]) + count($ilarge//student[count(meets/meet[@absent]) = 0]) + count($imssm//student[count(meets/meet[@absent]) = 0])"/></td>
							<th>Students attending 4/5</th>
							<td><xsl:value-of select="count($ismall//student[count(meets/meet[@absent]) = 1]) + count($ilarge//student[count(meets/meet[@absent]) = 1]) + count($imssm//student[count(meets/meet[@absent]) = 1])"/></td>
						</tr>
						<tr>
							<th>Students attending 3/5</th>
							<td><xsl:value-of select="count($ismall//student[count(meets/meet[@absent]) = 2]) + count($ilarge//student[count(meets/meet[@absent]) = 2]) + count($imssm//student[count(meets/meet[@absent]) = 2])"/></td>
							<th>Students attending 2/5</th>
							<td><xsl:value-of select="count($ismall//student[count(meets/meet[@absent]) = 3]) + count($ilarge//student[count(meets/meet[@absent]) = 3]) + count($imssm//student[count(meets/meet[@absent]) = 3])"/></td>
						</tr>
						<tr>
							<th>Students attending 1/5</th>
							<td><xsl:value-of select="count($ismall//student[count(meets/meet[@absent]) = 4]) + count($ilarge//student[count(meets/meet[@absent]) = 4]) + count($imssm//student[count(meets/meet[@absent]) = 4])"/></td>
							<th> </th>
							<td> </td>
						</tr>
						<tr><td><br/></td></tr>
						<tr>
							<th># in small school</th>
							<td><xsl:value-of select="count($ismall//student)"/></td>
							<th># in large school</th>
							<td><xsl:value-of select="count($ilarge//student)"/></td>
						</tr>
						<tr>
							<th># in mssm</th>
							<td><xsl:value-of select="count($imssm//student)"/></td>
							<th> </th>
							<td> </td>
						</tr>
		
					</tbody>
				</table>
			</body>
		</html>
	</xsl:template>
</xsl:stylesheet>
__________________
jasonkarldavis.com
jkd is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:01 PM.


Advertisement
Log in to turn off these ads.