View Single Post
Old September 27th, 2006, 03:45 AM
asearle asearle is offline
Authorized User
Join Date: Sep 2006
Location: Cologne, , Germany.
Posts: 92
Thanks: 0
Thanked 0 Times in 0 Posts

I think I understand the problem now: my javascript can accept and process entries found in the main XML file (i.e. the XML file calling the XSL) but if (anywhere in the XSL) I declare an external source (document($myparam) or document(myfile.xml)), then the content of the external file will be displayed but the script stops working. I assume that data from external XMLs can only be retrieved once?

Or is there a method to 'requery' the whole thing.

Anyway, here is my complete code. It displays the list of files OK and displays the content of the default declared file (file2.xml) but will not flip to display the contents of file1.

If I remove the declaration 'document($srce)' (and all associated code) then the selection works fine but of course there is no data to display.

I do hope you can help me with this one?

-- filelist.xml --
<?xml-stylesheet href="data.xsl" type="text/xsl"?>
<?xml version="1.0" encoding="UTF-8"?>

-- file1.xml --
<?xml version="1.0" encoding="UTF-8"?>

-- file2.xml --
<?xml version="1.0" encoding="UTF-8"?>

-- data.xsl --
<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="">

<xsl:param name="srce" select="'file2.xml'" />

<xsl:template match="/">


<script language="javascript" type="text/javascript">

function procss(srce){
  var s = new ActiveXObject("MSXML2.FreeThreadedDOMDocument");
  var x = document.XMLDocument;
  if (x == null){
   x = navigator.XMLDocument;
  var tem = new ActiveXObject("MSXML2.XSLTemplate");
  tem.stylesheet = s;
  var proc = tem.createProcessor();
  proc.addParameter("srce", srce);
  proc.input = x;
  var str = proc.output;

  var newDoc ="text/html");
  navigator.XMLDocument = x;
  navigator.XSLDocument = s;



   <form name="formfilt" id="formfilt">

     <label for="selsrce">Source</label><br />

     <select size="5" name="selsrce" id="selsrce">
       <xsl:apply-templates select="files" mode="fl">
       <xsl:sort order="descending"/>

    <input type="button" value="ausf├╝hren" onClick="procss(document.formfilt.selsrce.value)"/>

 <xsl:when test="$srce">

      <xsl:value-of select="$srce" />
      <xsl:apply-templates select="document($srce)" mode="disp">




<xsl:template match="/dataroot/item" mode="disp">
  <xsl:value-of select="."/>

<xsl:template match="files/file" mode="fl">
  <option value="{.}"><xsl:value-of select="."/></option>