[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: RE: JavaScript problem again!

Subject: RE: RE: JavaScript problem again!
From: Johannes.Becker@xxxxxx
Date: Tue, 5 Nov 2002 12:17:50 +0100
xsl loop counter
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.