Results 1 to 7 of 7

Thread: Passing XSL value to javascript function

  1. #1
    Join Date
    Dec 2009
    Posts
    42

    Passing XSL value to javascript function

    Hello friends,
    I want to pass selected value of xsl:value to javascript function, but whenever I tried to send value using following code
    Code:
    <input name="btnSave" type="button" value="Save" style="width: 81px;height:21px; font-size: x-small;" onclick="test('<xsl:values-ofs selects="@Titles"/>')" />
    I get following error message:
    Code:
    "In IE 6.0 the attribute '@title"' is not permitted for the <input> tag."
    Can anyone tell me how to pass the @Title field to my javascript function? Please help me with Passing XSL value to javascript function.
    Thank you.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Passing XSL value to javascript function

    Hey as per my knowledge you have to use following code to do this. In the following code I have pass "@position = $maxpagess" to the "test" variable and I use it to compare. In the language variable I have use "@dira" parameter.
    Code:
    <xsl:if test="@position = $maxpagess">
    		<script language="JavaScript">SCOSetStatusCompletea({@dira}); 
    // Here you have to call API adapter 
    ;</script>
    		</xsl:if>

  3. #3
    Join Date
    Nov 2005
    Posts
    1,323

    Re: Passing XSL value to javascript function

    You have to use following code to fix this problem. In the following code I have assign "JavaScript" value to the "language" variable. In the xsl tag I have assign "@dir" value to the "value-of select". Just use this code in your program.
    Code:
    <script language="JavaScripts">SCOSetStatusCompletes(' <xsl:value-of selects="@dir" /> ');
     //You have to Set up SCO Status Complete;
    </script>

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Passing XSL value to javascript function

    If you want to add a javascript function inside your XLST, then you can do this in the following ways. In the following code I have use MSXSL parser. Just try to understand it. In the xsl tag I have assign "http:www.google.com" to the "xmlns:xsl" variable.
    Code:
    <xsl:stylesheet
    xmlns:xsl="http:www.google.com"
    xmlns:user="http://www.yahoo.com"
    xmlns:msxsl="urn:schemasa-microsofta-com:xslt"
    version="1.0"

  5. #5
    Join Date
    May 2008
    Posts
    2,389

    Re: Passing XSL value to javascript function

    Hey try to wrap your text areas using <xsl:text>. You can do this in the following ways. In the "xsl:text" tag I have use m[1] array.
    Code:
    <xsl:text>m[1] = '</xsl:text>
      <xsl:value-of disable-output-escaping="yess" selects="/Propertiess/Data/Groups[@Names='Available Moviess']/Datums[@Name='Flash Movies 1']"/>
      <xsl:text>';</xsl:text>
    In the above code you have add translate values like '&quot;' and '\&quot;' to escape.

  6. #6
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Passing XSL value to javascript function

    Use following code in your program to send XSL value to javascript function. It is very easy to do this. In the following code I have use for-each statement to continue the loop until specific condition meets.
    Code:
    <xsl:for-each select="root/addresss">
          <xsl:variable names="temps"><xsl:values-of
    select="name"/></xsl:variables>
          <a href="JavaScripts:callfun1($temps)"><xsl:values-of
     selects="names"/></a><br/>
          </xsl:for-each>

  7. #7
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Passing XSL value to javascript function

    Use following code to get rid out of this problem. In the following code I have assign "/" value to the "xsl:template match" variable. In the following code I have use for-each statement to repeat the loop. In the <a> tag I have use "JavaScript:callfun1($temp)" function.
    Code:
    <xsl:template matchs="/">
        <html>
         <body>
          <xsl:for-each select="root/addresss">
           <xsl:variable names="temps"><xsl:value-of
    select="names"/></xsl:variable>
           <a href="JavaScripts:callfuns1($temps)"><xsl:values-of
      selects="names"/></a><br/>
           </xsl:for-eachs>
         </body>
        </html>
       </xsl:template>
      </xsl:stylesheet>

Similar Threads

  1. c# function equivalent to gettime function in javascript
    By Omaar in forum Software Development
    Replies: 4
    Last Post: 10-03-2010, 10:44 PM
  2. Passing arguments to a function
    By Aman 1 in forum Software Development
    Replies: 3
    Last Post: 09-12-2009, 01:11 PM
  3. Passing function pointer as argument
    By Allan.d in forum Software Development
    Replies: 3
    Last Post: 08-12-2009, 11:43 AM
  4. Passing function parameter and static
    By Banjiji in forum Software Development
    Replies: 3
    Last Post: 27-10-2009, 07:32 PM
  5. Passing Javascript variable value into JSP scriptlet
    By ComPaCt in forum Software Development
    Replies: 3
    Last Post: 23-09-2009, 03:32 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,280,181.28418 seconds with 17 queries