'How to call template on tab button onclick action in XSLT

I am trying to want to call a template on click of tab button. I have written below xsl which is currently not working.. Please let me know how I can achieve the same:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:param name="model"/>
    <xsl:param name="warningsText"/>
    <xsl:template match="/">
        <html>
            <body>
                <h1>
                    <xsl:value-of select="$model"/> model schema validation report
                </h1>
                <div>
                    <button class="tablink">
                        <xsl:attribute name="value">Error</xsl:attribute>
                        <xsl:attribute name="onclick">
                            <xsl:call-template  name="Error"/>
                        </xsl:attribute>
                    </button>
                </div>
            </body>
        </html>


Solution 1:[1]

If you want to call some function by clicking on a button - you should add JavaScript code. XSLT gives you the ability to generate HTML files from XML, but you cannot call XSLT templates from HTML output.

So your html part can be next:

<html>
<body>
<h1>
    <xsl:value-of select="$model"/>
    model schema validation report
</h1>
<div>
    <button className="tablink" value="Error" onClick="showErrorMessage()">
        The error button
    </button>
</div>
</body>
<script>
    function showErrorMessage() {
        // change code above
        alert("Hello! I am an error!!");
    }
</script>
</html>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Vasyl Krupa