Ciao a tutti,
ho un problema: vorrei richiamare una funzione javascript all'interno di un file xsl.
Il codice che ho scritto è il seguente:
ma lo script non funziona.Codice PHP:
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml">
<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>test</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" language="javascript">
<![CDATA[
var agent = navigator.userAgent.toLowerCase();
if (navigator.userAgent.match(/SymbianOS/i)) {
document.write("<link rel=\"stylesheet\" href="\templates\css\style.css\" type=\"text/css\" media=\"all\">");
}
else if ((navigator.userAgent.match(/Windows/i)) || (navigator.userAgent.match(/Linux/i)) || (navigator.userAgent.match(/Macintosh/i))) {
document.write("<link rel=\"stylesheet\" href=\"\templates\css\mobistyle.css\" type=\"text/css\" media=\"all\">");
}
]]>
</script>
</head>
<body>
</body>
</html>
</xsl:template>
</xsl:stylesheet>![]()
Ho provato anche ad inserire CDATA, ma il risultato non è cambiato.
Non sono un esperto di javascript e non capisco come sistemare il problema, qualcuno ha una dritta?
Grazie.