[xsl] Getting output from a dropdown (Spry) menu?

Subject: [xsl] Getting output from a dropdown (Spry) menu?
From: "Keith Hughes" <keithihughes@xxxxxxxxx>
Date: Thu, 22 Nov 2007 10:07:45 +0000
Hi all,
I'm trying to search an XML document using drop down menus. I'm
filtering using XSL, but I want to know how to use the output of a
Spry dropdown menu to filter the rest of the XML. Here's some basic

<?xml version="1.0" encoding="utf-8" ?>
- <!-- DWXMLSource="company.xml"
<!DOCTYPE xsl:stylesheet (View Source for full doctype...)>
- <xsl:stylesheet version="1.0" xmlnssl="http://www.w3.org/1999/XSL/Transform";>
<xslutput method="html" encoding="utf-8" doctype-public="-//W3C//DTD
XHTML 1.0 Transitional//EN"
- <xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml";
- <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="SpryAssets/xpath.js" type="text/javascript" />
<script src="SpryAssets/SpryData.js" type="text/javascript" />
- <script type="text/javascript">
- <xsl:text disable-output-escaping="yes">
- <![CDATA[ var ds1 = new Spry.Data.XMLDataSet("company.xml",

- <body>
- <div spry:region="ds1">
- <select name="select" spry:repeatchildren="ds1">
<option value="{job}">{job}</option>
<p> </p>
- <table border="1">
- <tr>
- <xsl:for-each select="company/department/employee">
- <xsl:if test="job = 'Programmer'">
- <tr>
- <td>
<xsl:value-of select="name" />
- <td>
<xsl:value-of select="job" />
- <td>
<xsl:value-of select="salary" />

As you can see, I'm currently filtering using a xml:if function. The
current filter will only give me the output of staff who are
programmers (<xsl:if test="job = 'Programmer'">). What I want to do is
use the output of the Spry drop down menu (ds1) to use as the filter,
e.g. <xsl:if test="job = DS1">, but I don't know the correct way to do

It may be easier t get rid of the Spry dropdown and use a xsl/html
dropdown instead, but Spry seemed to be an easier way to go.

I'm using Dreamweaver CS3 to produce this.

If anyone could help it would be great. Hopefully it's pretty simple.


Current Thread