Here's a more detailed explanation of what I'm trying to do:
I'm trying to use Javascript to set the filter criteria of my XSLT depending on the selection in a select menu.
Here's my XML:
<?xml version="1.0" ?>
<catalog>
<coupons>
<title>Title</title>
<category>Category</category>
<descrioption>Decription</descrioption>
<coupons>
<catalog>
<coupons>
<title>Title2</title>
<category>Category2</category>
<description>Decription2</description>
<coupons>
Here's my XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:key name="itemType" match="catalog/coupons/category" use="."/>
<xsl
aram name="category"/>
<xsl:template match="/">
<script language="JavaScript">
<xsl:comment>
function setForm()
{
alert ('hmmm...') }
</xsl:comment>
</script>
<table width="550" cellpadding="6" >
<tr >
<td >
<!-- DropDown -->
<xsl:element name="select" >
<xsl:attribute name="name">category</xsl:attribute>
<xsl:attribute name="onChange">setForm()</xsl:attribute>
<option name="selected">Choose Category </option>
<xsl:for-each select="catalog/coupons/category[count(. | key('itemType', .)[1]) = 1]">
<OPTION>
<xsl:attribute name="class"></xsl:attribute>
<xsl:value-of select="."/>
</OPTION>
</xsl:for-each>
</xsl:element>
<!-- DropDown -->
</td>
</tr>
</table>
<table width="600" cellpadding="6" >
<tr valign="top" class="underline">
<td align="left" width="200" >Title</td>
<td align="left" width="200">Category </td>
<td align="left" width="200">Description</td>
</tr>
<xsl:for-each select="catalog/coupons[category='@cateogry']">
<tr valign="top" class="underline">
<td >
<xsl:value-of select="title"/>
</td>
<td>
<xsl:value-of select="category"/></td>
<td>
<xsl:value-of select="description"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
I figure I can somehow pass the value from my select menu to the <xsl
aram name="category"/> so it will update the filter criteria in my <xsl:for-each> statement. I just have no idea what that javascript would be! The SetForm() function is just a test by the way.
Anyone have any ideas?
Thanks
Rick
I'm trying to use Javascript to set the filter criteria of my XSLT depending on the selection in a select menu.
Here's my XML:
<?xml version="1.0" ?>
<catalog>
<coupons>
<title>Title</title>
<category>Category</category>
<descrioption>Decription</descrioption>
<coupons>
<catalog>
<coupons>
<title>Title2</title>
<category>Category2</category>
<description>Decription2</description>
<coupons>
Here's my XSLT:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl=" <xsl:key name="itemType" match="catalog/coupons/category" use="."/>
<xsl
<xsl:template match="/">
<script language="JavaScript">
<xsl:comment>
function setForm()
{
alert ('hmmm...') }
</xsl:comment>
</script>
<table width="550" cellpadding="6" >
<tr >
<td >
<!-- DropDown -->
<xsl:element name="select" >
<xsl:attribute name="name">category</xsl:attribute>
<xsl:attribute name="onChange">setForm()</xsl:attribute>
<option name="selected">Choose Category </option>
<xsl:for-each select="catalog/coupons/category[count(. | key('itemType', .)[1]) = 1]">
<OPTION>
<xsl:attribute name="class"></xsl:attribute>
<xsl:value-of select="."/>
</OPTION>
</xsl:for-each>
</xsl:element>
<!-- DropDown -->
</td>
</tr>
</table>
<table width="600" cellpadding="6" >
<tr valign="top" class="underline">
<td align="left" width="200" >Title</td>
<td align="left" width="200">Category </td>
<td align="left" width="200">Description</td>
</tr>
<xsl:for-each select="catalog/coupons[category='@cateogry']">
<tr valign="top" class="underline">
<td >
<xsl:value-of select="title"/>
</td>
<td>
<xsl:value-of select="category"/></td>
<td>
<xsl:value-of select="description"/>
</td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
</xsl:stylesheet>
I figure I can somehow pass the value from my select menu to the <xsl
Anyone have any ideas?
Thanks
Rick