Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8774427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:33:55+00:00 2026-06-13T18:33:55+00:00

I am new to this so I don’t know whether this approach is the

  • 0

I am new to this so I don’t know whether this approach is the correct way to pass an argument. Please help me correct this or suggest another way to do this. I want to pass a node value from the xslt to a javascript function.

This is my XML file :

   <?xml version="1.0"?>
   <?xml-stylesheet type="text/xsl" href="sample.xsl"?>
   <One>
       <Two>
           HelloWorld
       </Two>
   </One>

This is the xslt file :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
<xsl:variable name="url" select="One/Two"/>
<xsl:template match="/">
<html>
    <script>
        function Myclick(vara)
        {
            alert(vara);            
        }
    </script>
    <xsl:for-each select="One">
        <a>
            <xsl:attribute name="href">
                http://www.google.com
            </xsl:attribute>
            <xsl:attribute name="onClick">                      
                alert($url);
                Myclick($url);
            </xsl:attribute>            
            <xsl:value-of select="Two"/>
        </a>
    </xsl:for-each>
</html>
</xsl:template>

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:33:56+00:00Added an answer on June 13, 2026 at 6:33 pm

    Try this:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xlink="http://www.w3.org/1999/xlink">
        <xsl:variable name="url" select="One/Two"/>
        <xsl:template match="/">
            <html>
                <head>
                    <script>
                        function Myclick(a)
                        {
                            var href = a.getAttribute('href');
                            alert(href);
                            location.href= href;
                        }
                    </script>
                </head>
                <body>
                    <xsl:for-each select="One">
                        <a>
                            <xsl:attribute name="href">
                                http://www.google.com
                            </xsl:attribute>
                            <xsl:attribute name="onClick">
                                javascript:Myclick(this); return false;
                            </xsl:attribute>
                            <xsl:value-of select="Two"/>
                        </a>
                    </xsl:for-each>
                </body>
            </html>
        </xsl:template>
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to PHP so I don't know whether this is possible. I need
I don't know if this is a well known 'thing' or something new in
I don't know why this is happening, but when I create a new form
I'm new to Qt and I don't know how to fix this. I have
I'm quite new to PHP so I don't know how to solve this error.
The following code don't work- TextView myLocation = new TextView(this); myLocation.setText(Sodala, Jaipur, Rajasthan, IN);
I've received a new computer from my employer. This time I don't want to
I am new to jQuery and so don't mind this question if it sounds
I'm really new to this and I don't have any idea how to do
as I'm very new to this field i don't have much knowledge in this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.