logo-dw

Go Back   Dreamweaver Club Forums > Dreamweaver forums > Spry
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 11-21-2007, 02:16 PM   #1
Yossa
 
Join Date: Nov 2007
Posts: 1
Default Getting output from Spry dropdown?

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 code:

HTML Code:
<?xml version="1.0" encoding="utf-8" ?> 
- <!-- DWXMLSource="company.xml" 
--> 
<!DOCTYPE xsl:stylesheet (View Source for full doctype...)> 
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" /> 
- <xsl:template match="/">
- <html xmlns="http://www.w3.org/1999/xhtml" xmlns:spry="http://ns.adobe.com/spry">
- <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", "company/department/employee/job",{distinctOnLoad:true});
 
]]> 
</xsl:text>
</script>
</head>
- <body>
- <div spry:region="ds1">
- <select name="select" spry:repeatchildren="ds1">
<option value="{job}">{job}</option> 
</select>
</div>
<p> </p> 
- <table border="1">
- <tr>
<th>Name</th> 
<th>Job</th> 
<th>Salary</th> 
</tr>
- <xsl:for-each select="company/department/employee">
- <xsl:if test="job = 'Programmer'">
- <tr>
- <td>
<xsl:value-of select="name" /> 
</td>
- <td>
<xsl:value-of select="job" /> 
</td>
- <td>
<xsl:value-of select="salary" /> 
</td>
</tr>
</xsl:if>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
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 this.

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

Cheers.
Yossa is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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. The time now is 12:55 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com