...

View Full Version : populate a drop down from another xml file



thinguy
11-05-2002, 08:22 PM
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>

WA
11-05-2002, 08:44 PM
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...

thinguy
11-11-2002, 06:41 PM
Anyone have any insight on this?

Thanks

jkd
11-11-2002, 06:56 PM
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:



<?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>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum