[xsl] Passing javascript value into xsl

Subject: [xsl] Passing javascript value into xsl
From: Mick <mick@xxxxxxxxxxxx>
Date: Mon, 5 Feb 2001 20:33:56 +0100
Hi all,

I have the following problem: I would like to pass a value obtained from a
pull down list (value obtained through xsl from an xml file) to a function
that will filter the same xml file for additional data. The xsl for the pull
down list is:

<form name="tales">
<select id="tales" onChange="displayList(this.form)">
<option value="">select a tale</option>
	<xsl:for-each select="mabinogion/tale/talename">
		<option value="{.}">
			<xsl:value-of select="."/>
		</option>
	</xsl:for-each>
</select>
</form>

The value of the pull down menu is stored as javascript "var x =
tales.tales.value". I want to use this value as a filter for another bit of
xsl:

<xsl:for-each select="mabinogion/tale[talename=' ->x goes here<- ']">
	<xsl:for-each select="manuscript">
		<xsl:value-of select="manuscriptname"/>
		<br/>
	</xsl:for-each>
</xsl:for-each>

and use the result of this xsl to populate <div id="list"></div> through:

<script language="JavaScript">
function
{
list.innerHTML = ->result of the previous xsl<-
}
</script>

All above bits work well seperately, but I can't get the whole thing to work
together (the quotes are probably the problem, but I've tried every possible
combination). Has anyone got any hints/clues/ideas/valium?

-mick



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread