[xsl] Multiple select listbox as parameter

Subject: [xsl] Multiple select listbox as parameter
From: <mfreeman@xxxxxxxxxxxx>
Date: Fri, 10 Mar 2006 8:11:31 -0500
Hi all.  I could really use some help... 

My XML looks like this:<?xml version='1.0'?> 
<Data> 
     <Indicator KEY='001'> 
           <Group Key='001'/> 
           <Group Key='005/> 
     </Indicator> 
     <Indicator KEY='002'> 
          <Group KEY='003'/> 
          <Group KEY='002'/> 
     </Indicator> 
     <Indicator KEY='003'> 
          <Group KEY='004'/> 
          <Group KEY='003'/> 
     </Indicator> 
</Data> 


I have a list box, where you can select multiple Groups.  If I select 
groups 002 and 001, it should return Indicators 001 and 002.  The 
paramater that I pass is 001,002,.  So from my XSL, I tried two things. 
 First was to see if the parameter contained the key: 


<xsl:for-each select="Indicator"> 
<xsl:when test="contains($lstGroup,Group/@KEY)"> 
  ...do something... 
</xsl:when> 
<xsl:for-each> 


This worked great, but only if the first group matched the criteria. 
So it returns just indicator 001. 


Then I tried this: 


<xsl:for-each select="Indicator"> 
<xsl:when test="Group[@KEY=$lstGroup]"> 
  ...do something... 
</xsl:when> 
<xsl:for-each> 


And this works great, except it will not accept a multiple list from 
the list box.  Only when I pass one choice to the paramater. 


I tried this: 


<xsl:for-each select="Indicator"> 
<xsl:when test="contains($lstGroup,Group[@KEY])"> 
  ...do something... 
</xsl:when> 
<xsl:for-each> 


But this returned all indicators. 


Is there a way to combine the two working bits of code to do what I 
want to do?  It may be in the way I call the parameter, or it may be in 
the output code.  Here's how I call the parameter from a multiselect 
list box: 


(This is on my HTML page) 
var as Values = New Array(); 
var oSel = document.sel.lstGroup; 
var strGroup1 = "" 
for (var i-0; i<oSel.length;i++)[ 
     if (oSel.options[i].selected){ 
          asValues[asValues.length]=oSel.options[i].value; 
          strGroup1=strGroup1 + oSel.options[i].value + ","; 
     } 


} 


xslproc.addparameter("lstGroup",strGroup1,""); 

This passes '001,002,' to my xsl page. 

Here is the full version of all of the code. 

http://www.comptrex.com/eed/EED.htm 


I also noticed since I put it up, that it's unbearably slow.  Any 
suggestions for that? 




Any help is greatly appreciated. 
Thanks, 

Current Thread