Visualizzazione dei risultati da 1 a 3 su 3

Discussione: JavaScript in XSL

  1. #1

    JavaScript in XSL

    Qualcuno sa come fare ad implementare un semplice JavaScript dentro ad un foglio di stile XSL? Io ho provato TUTTO, mi sono letto TUTTE le guide che ho trovato, in italiano e anche in inglese, ma non sono MAI riuscito a far funzionare questo semplicissimo script (che ovviamente in HTML funziona perfettamente).

    Qualche idea?

    codice:
    <html>
    <title>titolo</title>
    <head>
    </head>
    
    <body>
    il browser in uso &egrave;:<h1>
    <script language="javascript"><!--
    	document.write(navigator.appName);
    //--></script></h1>
    
    test del browser
    
    </body>
    </html>
    ...che implementato in un foglio XSL dovrebbe diventare

    codice:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" indent="yes"
    	doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
    	doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" />
    
    <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
    <title>titolo</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    </head>
    
    <body>
    <div>
    browser in uso:
    <h1>
    
    <script type="text/javascript" language="javascript">
    <![CDATA[
        document.write(navigator.appName);
    ]]>
    </script>
    
    </h1>
    ...non riesco a far funzionare lo script che dovrebbe scrivermi qui sopra il nome del browser, e allo stesso modo qualunque altro script di JavaScript che provi ad integrare
    </div>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
    ...qualcuno ci ha già sbattuto la testa??
    MaX

  2. #2
    <html>
    <body>

    <script type="text/javascript">
    document.write("Browser CodeName: " + navigator.appCodeName);
    document.write("

    ");
    document.write("Browser Name: " + navigator.appName);
    document.write("

    ");
    document.write("Browser Version: " + navigator.appVersion);
    document.write("

    ");
    document.write("Cookies Enabled: " + navigator.cookieEnabled);
    document.write("

    ");
    document.write("Platform: " + navigator.platform);
    document.write("

    ");
    document.write("User-agent header: " + navigator.userAgent);
    </script>

    </body>
    </html>


  3. #3
    ...posso chiederti come questo può aiutarmi?
    MaX

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.