Jump to content

wallyson

Members
  • Posts

    28
  • Joined

  • Last visited

Posts posted by wallyson

  1. Well, the reason for your problem is in your description of it:XSLT expects an XSLT variable/parameter or a direct node set (XPath expression). It can't process variables from another language.What you can do is to store the pass as a XSLT parameter, and use that parameter's value instead.
    <xsl:param name="pass"/>function showCountries(pass){	var results ='';	var sendtoDIVid = "requests"; 	switch(pass)	{		case pass:			results +='<p style="color: Navy">Countrys</p>'+			'<p style="color: Navy">'+pass+' 2006</p>'+			'<ul>'+']]><xsl:for-each select="Holidays/Days/Data[Holiday = $pass]"><![CDATA['+			  '<li style="color: navy">'+']]><xsl:value-of select="Country"/><[CDATA[</li>'+					']]></xsl:for-each><![CDATA['+			'</ul>'+			'</table>';						document.getElementById(sendtoDIVid).innerHTML = results;		break;		default: 	}}]]></script>

    then, in the output, you need to make a call to another function, which will change that parameter's value. When that value is changed, so is the value of this script. this post demostrates a JavaScript function that is going to change the parameter. I'm not good at JavaScript, so I can't adjust that script for you.

    Thanks man, but I get a "cant use key word param here" when trying to make the convert, do you know any other tricks with working with other languages variables? thanks Andrew
  2. Well, you certainly don't have a "Holiday" element, which value is eaxctly '+pass+' and that's your problem.What exactly are you trying to achieve?
    Holiday is in the XML file.pass is sent from another function called showHolidays.pass will be a holiday.then in the xsl the the Holiday element will check pass and if they equal, it will print out that country.It works when you type in the name of a country, but i dont wnat it to that obviously. Some wierd reason it wont check agiasnt that Jscript Variable. This goal is easy, i have an xml file with countries and holidays, im making it sort through them.what you dont see is the drop down were the user selects a month.then all the holidays in that month are shown.then you click on a holidaythen the countries show up that celebrate that holiday.its messing up at the showing the countries part. and thats why i posted.
  3. Here is snippet of my xml :<Holidays>	<Months>		<Data>			<Name>August</Name>		</Data>	</Months>	<Days>		<Data>			<Day>1</Day>			<Holiday>Emancipation Day</Holiday>			<Country>(BRB, JAM, TTO)</Country>		</Data>		<Data>			<Day>1</Day>			<Holiday>Parents Day</Holiday>			<Country>(COG)</Country>		</Data>............................................Ok here is a Jscript function in my XSL code:function showCountries(pass){	var results ='';	var sendtoDIVid = "requests"; 	switch(pass)	{		case pass:			results +='<p style="color: Navy">Countrys</p>'+			'<p style="color: Navy">'+pass+' 2006</p>'+			'<ul>'+']]><xsl:for-each select="Holidays/Days/Data[Holiday = '+pass+']"><![CDATA['+			  '<li style="color: navy">'+']]><xsl:value-of select="Country"/><[CDATA[</li>'+					']]></xsl:for-each><![CDATA['+			'</ul>'+			'</table>';						document.getElementById(sendtoDIVid).innerHTML = results;		break;		default: 	}}]]></script>...............................................Ok the pass variable comes in and has a holiday for example 'Emancipation Day', that variable is then Checked agaisnt Holiday, then it will print out the country that celebrates 'Emancipation Day'.Well it doesnt work, I know my logic is right becuase if type in 'Emancipation Day'where [Holiday = 'pass'] is at (so: [Holiday = 'Emancipation Day']) it works.How do I get that Jscript variable to work?PS. I already tried writing it so that pass had single quotes " ' " around it.Please help.

×
×
  • Create New...