Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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 10:04 PM.

  • #2
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    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.

  • #3
    New to the CF scene
    Join Date
    Sep 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Anyone?

    Anyone have any insight on this?

    Thanks

  • #4
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    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>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •