Ho provato in tutti i modi a passare una variabile dichiarata in JavaScript al file xsl ed ho trovato un codice, che dice di creare un parametro con XSL (param name=...)

Tutto questo perchè mi serviva una variabile che si trovava nel referrer ed in JavaScript sò come estrarla mentre con XSL no.

Ho seguito tutto il discorso l'ho implementato ma ora ricevo un errore JavaScript:

the stylesheet does not contain a document element, or the Xml file is not well formed.

File.Htm
codice:
<script language="JavaScript">
//JavaScript
urlstring = location.href;
qrystring=urlstring.substring(urlstring.indexOf("=") + 1, urlstring.length);
alert(qrystring);
//Ambiente per Impostazione Variabili per XSL
var xml = new ActiveXObject("MSXML2.DomDocument.4.0");
  xml.async = false;
  xml.load("DBFiabe.xml");

 var xsl = new ActiveXObject("MSXML2.FreeThreadedDomDocument.4.0");
  xsl.async = false;
  xsl.load("DBFiabe.xsl");

  var template = new ActiveXObject("MSXML2.XSLTemplate.4.0")
  template.stylesheet = xsl
  processor = template.createProcessor()

  processor.input = xml
  processor.addParameter("param1", qrystring)


  processor.transform()

  document.open()
  document.write(processor.output)
  document.close()
</script>
File Xsl
codice:
<?xml version="1.0" encoding="UTF-8" ?>
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="param1"/>
<xsl:template match="/">
<html>
<head>
<title>Fiaba</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="DBFiabe">
 <xsl:for-each select="//fiaba">
<xsl:if test="@number=$param1">
 <xsl:value-of select="body"/>
 </xsl:if>
 </xsl:for-each>
</xsl:template>
</stylesheet>
File Xml
codice:
<?xml version="1.0" encoding="iso-8859-1"?>
<DBFiabe>
<fiaba number="1">
<title>Ma bella addormentata</title>
<audio></audio>
<body>ilhiohòoilhlòkhjklhkòjhoòihkj.hòklhkòhkjhkjhjhvg hv yhgjhghjgjhgu
ukhukhikhkuhiuhuiob
klnjlknkln</body>
</fiaba>
<fiaba number="2">
<title>La pendicana: Monica</title>
<audio></audio>
<body></body>
</fiaba>
<fiaba number="3">
<title></title>
<audio></audio>
<body></body>
</fiaba>
</DBFiabe>