Re: [xsl] tableheader sort on date with DOM dynamically and optimisation xslt/xml code

Subject: Re: [xsl] tableheader sort on date with DOM dynamically and optimisation xslt/xml code
From: "Carsten Klein" <carstenklein@xxxxxxxx>
Date: Mon, 8 Apr 2002 16:24:49 +0200
Hi Hans,

well, the example given was not that complicated and as far as I get
your point straight,
you are using msxml ActiveX object when using

Or are you using data isles? Do they permit the use of
transformNode()? If so, my lack of knowledge.

: output.innerHTML = xmlDoc.documentElement.transformNode(xslDoc);

Hm, this is a good point, replacing the innerHTML, since this is not
standard html.

But, since transformNode does not return an object other than String
you will need to use a
different method...

Here is a script snippet I got from
http://msdn.microsoft.com/library/en-us/xmlsdk/htm/xml_mth_sz_2jp0.a
sp

Hope they don't mind, me quoting this one.

<script>
 // Load data.
  var source = new ActiveXObject("Msxml2.DOMDocument.4.0");
  source.async = false;
  source.load("data.xml");

  // Load style sheet.
  var stylesheet = new ActiveXObject("Msxml2.DOMDocument.4.0");
  stylesheet.async = false;
  stylesheet.load("style.xsl");

  // Set up the resulting document.
  var result = new ActiveXObject("Msxml2.DOMDocument.4.0");
  result.async = false;
  result.validateOnParse = true;

  // Parse results into a result DOM Document.
  source.transformNodeToObject(stylesheet, result);
</SCRIPT>

As you can see, this will create a DOM document (fragment) by
writing the object
to variable result. I don't know if you have to provide an instance
of a MSXML DOMDocument
or you may setup an empty variable and write the transformation
result to this variable. If it does, you
may then add this to the dom using

    var result = null;
    xmlDoc.documentElement.transformNodeToObject(xslDoc, result);
    document.getElementById("InsertHere").appendChild(result);

But since the innerHTML attribute is supported by nearly(?) all user
agent implementations, this
should not be that much of a problem. Except when the user has
disabled writing to the document from script.
But I don't know if this does not imply, too, that creating element
nodes and inserting these nodes to the
dom will be disabled as well.

And, yes, a user may certainly include your site to his trusted
sites list.
A bit complicated for the user to manage, though.

Hope this helps,

Carsten


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread