RE: RE: [xsl] JavaScript problem again!

Subject: RE: RE: [xsl] JavaScript problem again!
From: Johannes.Becker@xxxxxx
Date: Tue, 5 Nov 2002 12:17:50 +0100
Hi,

it gives an error on this part:
....
<xsl:for-each select
="/portalLogin/frameMain/rowsReport/select_service/select_option_1">
    document.reportFrm.service.options[i++] = new Option('<xsl:value-of
select="@text"/>','<xsl:value-of select="@value"/>');
</xsl:for-each>
....

What error I dont know?`


My XSL:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform"; xmlns:fo="
http://www.w3.org/1999/XSL/Format";>


  <xsl:template match="/portalLogin">
    <html>
      <head>
        <title>
           <xsl:value-of select="@title"/>
        </title>

        <script LANGUAGE="JavaScript">
           <xsl:comment>
             <![CDATA[
               function fillDate()
               {
                 ...
               }


               function wechsel()
               {
                 choiceReport=document.reportFrm.report.selectedIndex;
//Bestimmen welcher Eintrag markiert ist
                 while (document.reportFrm.service.length > 1) //Alle
Einträge(ausser der Kopfzeile[index0])löschen
                 {

document.reportFrm.service.options[document.reportFrm.service.length-1]=null;
                 }
                 if (choiceReport > 0) //Nur wenn die choiceReport im
Steuerungsfeld größer als 0(0=kopfzeile),werden werte in serviceFeld
eingetragen
                 {
                   switch (choiceReport)
                   {
                     case 0:
                       // alert(choiceReport);
                       var i = 1; // a loop counter for the options array
                         <xsl:for-each select
="/portalLogin/frameMain/rowsReport/select_service/select_option_0">
                           document.reportFrm.service.options[i++] = new
Option('<xsl:value-of select="@text"/>','<xsl:value-of select="@value"/>');
                       </xsl:for-each>
                       break;
                     case 1:
                       // alert(choiceReport);
                       var i = 1; // a loop counter for the options array
                         <xsl:for-each select
="/portalLogin/frameMain/rowsReport/select_service/select_option_1">
                           document.reportFrm.service.options[i++] = new
Option('<xsl:value-of select="@text"/>','<xsl:value-of select="@value"/>');
                       </xsl:for-each>
                       break;
                     case 2:
                       // alert(choiceReport);
                       var i = 1; // a loop counter for the options array
                         <xsl:for-each select
="/portalLogin/frameMain/rowsReport/select_service/select_option_2">
                           document.reportFrm.service.options[i++] = new
Option('<xsl:value-of select="@text"/>','<xsl:value-of select="@value"/>');
                       </xsl:for-each>
                       break;
                     default:
                       // alert(choiceReport);
                       var i = 1; // a loop counter for the options array
                         <xsl:for-each select
="/portalLogin/frameMain/rowsReport/select_service/select_option_3">
                           document.reportFrm.service.options[i++] = new
Option('<xsl:value-of select="@text"/>','<xsl:value-of select="@value"/>');
                       </xsl:for-each>
                       break;
                   }
                 }
                 document.reportFrm.service.selectedIndex=0
               }

             //]]>
           </xsl:comment>
        </script>



<!-- The template where the function wechsel() is called -->

<xsl:template match="/portalLogin/frameMain/rowsReport">
    <form name="reportFrm">
      <table bgColor="#cccccc" border="0" cellPadding="0" cellSpacing="2" >
        <tr>
           <td width="150">
             <label>
               <font face="Arial" size="3" color="#DD0016">
                 <strong>
                   <xsl:value-of select="lbl_report/@name"/>
                 </strong>
               </font>
             </label>
           </td>
           <td>
             <select name="report" onchange="wechsel();">
               <option>
                    <xsl:value-of select="select_report/@greeting"/>
               </option>
               <xsl:for-each select="select_report/select_option">
                 <option>
                   <xsl:value-of select="@text"/>
                 </option>
               </xsl:for-each>
             </select>
           </td>
           <td/>
           <td/>
        </tr>
        <tr>
           <td width="150">
             <label>
               <font face="Arial" size="3" color="#DD0016">
                 <strong>
                   <xsl:value-of select="lbl_service/@name"/>
                 </strong>
               </font>
             </label>
           </td>
           <td>
             <select>
               <xsl:attribute name="name">
                 <xsl:value-of select="select_service/@name"/>
               </xsl:attribute>
               <option>
                   <xsl:value-of select="select_service/@greeting"/>
                 </option>
             </select>
           </td>
           <td/>
        </tr>
      </table>
    </form>
    </xsl:template>




I hope this helps.


Thanks
Jonny



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


Current Thread