XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 2nd, 2004, 05:29 PM
Kim Turley Kim Turley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 21 Kim Turley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
setting xsl parameter from dropdown menu

What i want to be able to do is the user selects a date from the drop down menu, the form selects a value, which will change the value in the xslaram statement below to whatever is selected

<xslaram name="votedate">07/03/04</xslaram

<form name="exampleForm">
<select name="exampleSelect">
<option value="15/02/04">15/02/04</option>
<option value="22/02/04">22/02/04</option>
<option value="29/02/04">29/02/04</option>
</select>
<input type="submit" value="Submit" onclick="doAlert()" />
</form>

<xsl:for-each select="//A[VOTEDATE=$votedate]">
<xsl:sort select="VOTES" data-type="number" order="descending"/>

I just can't seem to get it working. The actual page can be found here:
http://www.gre.ac.uk/~tk301/3dmm/results.html

Reply With Quote
  #2  
Old May 8th, 2004, 09:01 AM
Kim Turley Kim Turley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 21 Kim Turley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
anyone?

Reply With Quote
  #3  
Old May 9th, 2004, 11:09 PM
terminal's Avatar
terminal terminal is offline
nx
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: USA
Posts: 626 terminal Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 28 m 37 sec
Reputation Power: 0
Send a message via AIM to terminal
the only solution i know of is to use some server-side page to print out the xsl data with the text/xsl content-type header and dynamically create the parameter...

Reply With Quote
  #4  
Old May 10th, 2004, 07:18 AM
Kim Turley Kim Turley is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 21 Kim Turley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Solution

Yep i found out the solution,

<table cellpadding="0" cellspacing="0" border="0" bgcolor="white" width="100%" align="center"><tr><td>
<div id="target"></div>
<SCRIPT LANGUAGE="JavaScript">
function doTransform(){
var objXSLT = new ActiveXObject("MSXML2.FreeThreadedDomDocument");
objXSLT.async = false;
objXSLT.load("data/votestylesheet.xsl");
var objCompiled = new ActiveXObject("MSXML2.XSLTemplate");
objCompiled.stylesheet = objXSLT.documentElement;
var objXSLProc = objCompiled.createProcessor();
var objXML = new ActiveXObject("MSXML2.FreeThreadedDomDocument");
objXML.preserveWhiteSpace = true;
objXML.async = false;
objXML.load("data/votes2004.xml");
objXSLProc.input = objXML;
objXSLProc.addParameter("votedate", voteDate + "");
objXSLProc.transform();
target.innerHTML = objXSLProc.output;
}
</SCRIPT></table>

in the html page and then

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xslutput method="html" encoding="UTF-8"/>
<xsl:key name="kDate" match="*[VOTEDATE]" use="VOTEDATE"/>
<xslaram name="votedate" select="//*[VOTEDATE]"/>
<xsl:template match="/">
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
<tr>
<td rowspan="2" valign="top" align="center" width="175">
<form name="exampleForm">
<select name="exampleSelect" onchange="changeVoteDate(this.value)">
<option value="" selected="selected">Select A Date</option>
<option value="">Show All</option>
<xsl:for-each select="/MOVIES/*[generate-id() = generate-id(key('kDate', VOTEDATE))]">
<option value="{VOTEDATE}">
<xsl:value-of select="VOTEDATE"/>
</option>
</xsl:for-each>
</select>
</form>
</td>

<td valign="bottom"><font face="verdana" size="1" color="black">
<b>Date:</b> *<xsl:value-of select="$votedate"/>
</font></td></tr>
<tr><td valign="top"><font face="verdana" size="1" color="black">
<b>Total Votes:</b> *<xsl:value-of select="sum(//A[VOTEDATE= $votedate]/VOTES)"/>
</font>
</td></tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="500" align="center">
<xsl:choose>
<xsl:when test="$votedate != ''">
<xsl:apply-templates select="MOVIES/*[VOTEDATE = $votedate]">
<xsl:sort select="VOTES" data-type="number" order="descending"/>
</xsl:apply-templates>
</xsl:when>
<xsltherwise>
<xsl:apply-templates select="MOVIES/*[VOTEDATE]">
<xsl:sort select="MOVIENAME" data-type="text" order="ascending"/>
</xsl:apply-templates>
</xsltherwise>
</xsl:choose>
</table>
</xsl:template>
<xsl:template match="*[VOTEDATE]">

<tr class="blue">
<td align="left" valign="top" width="200"><font face="verdana" size="1" color="#F7F7F7">
<xsl:attribute name="id"><xsl:value-of select="MOVIENAME"/></xsl:attribute>
<xsl:element name="a"><xsl:attribute name="href">search.html?searchCriteria=<xsl:value-of select="MOVIENAME"/>&searchField=MOVIENAME
</xsl:attribute><xsl:value-of select="MOVIENAME"/></xsl:element></font></td>
<td align="center" valign="top" width="60"><font face="verdana" size="1" color="black">
(<xsl:value-of select="RELEASEDATE"/>)</font></td>
<td align="left" valign="top" width="100">
<img border="0" alt="Results">
<xsl:attribute name="src">images/pollendleft.jpg</xsl:attribute>
<xsl:attribute name="height">10</xsl:attribute>
<xsl:attribute name="width">4</xsl:attribute>
</img>
<img border="0" alt="Results">
<xsl:attribute name="src">images/poll.jpg</xsl:attribute>
<xsl:attribute name="height">10</xsl:attribute>
<xsl:attribute name="width">
<xsl:variable name="totalMovies" select="sum(//A[VOTEDATE = $votedate]/VOTES)"/>
<xsl:variable name="countVotes">
<xsl:value-of select="VOTES"/></xsl:variable>
<xsl:variable name="totalPercent">
<xsl:value-of select="$countVotes div $totalMovies"/></xsl:variable>
<xsl:value-of select="$totalPercent * 100"/>
</xsl:attribute>
</img>
<img border="0" alt="Results">
<xsl:attribute name="src">images/pollendright.jpg</xsl:attribute>
<xsl:attribute name="height">10</xsl:attribute>
<xsl:attribute name="width">4</xsl:attribute>
</img>
</td>
<td align="left" valign="top" width="5"><font face="verdana" size="1" color="black">
<xsl:variable name="totalVotes" select="sum(//A[VOTEDATE = $votedate]/VOTES)"/>
<xsl:variable name="countVotes"><xsl:value-of select="VOTES"/></xsl:variable>
<xsl:variable name="totalPercent">
<xsl:value-of select="$countVotes div $totalVotes"/></xsl:variable>
<xsl:value-of select="round($totalPercent * 100)"/>%</font></td>
</tr>
</xsl:template>
</xsl:stylesheet>


that is the stylesheet that sets the parameter from a drop down list

Reply With Quote
  #5  
Old May 19th, 2004, 09:19 AM
NickBoldt NickBoldt is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 3 NickBoldt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Does that work cross-browser? Looks like you're only coding for the MSIE world. How does Moz, Opera, and Netscape work with your code?

Reply With Quote
  #6  
Old May 21st, 2004, 10:18 PM
terminal's Avatar
terminal terminal is offline
nx
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2003
Location: USA
Posts: 626 terminal Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 5 h 28 m 37 sec
Reputation Power: 0
Send a message via AIM to terminal
exactly my point...which is why i said "server-side", not client-side.
anyways, i do believe there is some sorta xml document loading object for moz...i found it earlier...im just having trouble relocating it..

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > setting xsl parameter from dropdown menu


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT