RE: [xsl] converting xsl-wd to xsl1, msxml script changes

Subject: RE: [xsl] converting xsl-wd to xsl1, msxml script changes
From: Woody <woody@xxxxxxxxxxxxxx>
Date: Thu, 13 Feb 2003 23:11:00 +0000
From: "bryan" <bry@xxxxxxxxxx>

I am calling it with <xsl:value-of select="msxml:transform('.')"/>

and I am trying to get the node set of the object - I don't know what
it is I am getting and I am having difficulty finding it out. (I have
also tried sending it different things, putting it in a variable,
putting msxsl:node-set.. etc)

here's an example that works for me of getting a node-set with an extension function;

<msxsl:script language="JScript" implements-prefix="test">
   function test(value){
var oDom;
var xmlnodes;
oDom=new ActiveXObject("msxml2.domdocument.4.0");
 xmlnodes = value;
oDom.load(xmlnodes);
      return oDom;
  }
</msxsl:script>

snip


ahh. maybe this is my problem. in msxml3 (or 4) do I have to load the additional msxml parser to get the values out?
I don't do this (and neither do the files I inherited) as the xml-xsl parsers are created by an external program and fed the xml & xsl.


I don't know, I am new at this but I do know there is a comment in
the file from a few years ago which says the xsl version was replaced
by the javascript version for a 7 times speed increase, and there is
timing code in there. maybe it is different now but my concern is
that I have many of these files that I want to convert and they all
have the same node passing problem.

Well a 7 times speed increase can be caused by lots of things, in my experience by bad xslt - which I guess would comprise any wd-xsl :) Not that that's a hit on whoever wrote it first - with my luck it would turn out to be one of my early efforts.

I guess. I am new at this and in no position to say whether it is good or bad - it certainly worked but the formats have changed.


I was thinking more along the lines of, a description of what one wants
to do with examples etc. and it could be that various people on this
list would say - "do this instead"

thats very simple - I want, while parsing an xml file to be able to get a node set of whatever type it is to be passed to an javascript function in a state where I can do operations on it. so in:


<level1>
  <level2>
    <level3>blah</level3>
  <level2 id="3"/>
  <level2>
     hello
     <level3 name="wobble"/>
  <level2>hello again<level2>
</level1>


<xsl:template match="/level2"> <xsl:value-of select="msxsl:test(.)"/> </xsl:template>


<msxml:script name="JScript" implements-prefix="test">


function test(node)
  {
  if(node.length > 0 && node.type != "object")
	// TIME TO PARTY
  }


Obviously not exactly like this but I want the value sent to a javascript to be something I can do something with. I can send a string, I can send a number but I can't send a set of nodes and thats what I want to do.


Again it is difficult to give suggestions without examples, if there is
something in these files that is proprietary than make an abstract case
and example that requires the same handling.

that is obviously abstract as the real thing is not mine to write out!
Its just a passing problem of nodes. Some of those nodes have to exit the program by way of a javascript function and all I get is a 0 or 1 length 'object' that I can't do anything with - if I do node.nodeType I get 'undefined'.


Thanks for the help everyone - although I haven't solved it yet you have all been very willing to help, unlike a lot of lists!

Woody

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


Current Thread