Loading ...
Sorry, an error occurred while loading the content.

Changing XSL variable value dynamically

Expand Messages
  • kiranv
    Hi Can any body please help me to over come this problem?This problem mainly because i don t know exactly how to change XSL variable value based on the
    Message 1 of 1 , Jan 10, 2002
    • 0 Attachment
      Hi
       
      Can any body please help me to over come this problem?This problem mainly because i don't know exactly  how to change XSL variable value based on the  condition.
      The below program explains about the problem.
       
      My project requires multiple customers to be assigned to Users.For example if i have 10 customers and i assigned 5 to my user .But while modifying ,On users screen 5 customers should be selected and 5 customers should not be selected.But XSL  coming from the database  for queryresult/selected/result/searchresult/customeruid it is returning 5 values.
      For  /queryresult/options/result/searchresults/customeruid it is returning  10 customers .So i have to check programetically which customer has to be selected  and which should not be selected
       
      Thank You and Regards
      Vasireddy Kiran Kumar

         
      <select name="customer" size="4" multiple="true">
       <xsl:for-each select="/queryresult/selected/result/searchresult/customeruid">
         <option value="{.}">
         <xsl:attribute name="selected"><xsl:text>true</xsl:text></xsl:attribute>
         <xsl:value-of select="."/>
         </option>
       </xsl:for-each>
       <xsl:for-each select="/queryresult/options/result/searchresults/customeruid">
          <xsl:variable name="flag1">false</xsl:variable>
           <xsl:variable name="e1" select="."/>
           <xsl:for-each select="/queryresult/selected/result/searchresult/customeruid">
            <xsl:variable name="e2" select="."/> 
            
            <xsl:choose>
               <xsl:when test="contains($e1,$e2) and string-length($e1) = string-length($e2)">                 
              
                  <setvar name="flag1" value="true"/>         
       

               </xsl:when>
               </xsl:choose>
           </xsl:for-each>
           <xsl:variable name="test1">false</xsl:variable>
            <xsl:choose>                  
                <xsl:when test="contains($flag1,$test1)">
                <option value="$e1">
                <xsl:value-of select="$e1"/>
                </option>
               </xsl:when>
               </xsl:choose>
               <xsl:variable name="flag1">false</xsl:variable>
       </xsl:for-each>
                   
       
                       
          
      </select>
    Your message has been successfully submitted and would be delivered to recipients shortly.