xsl-list
[Top] [All Lists]

Re: using the mozilla xsl rendering engine

2002-12-29 16:41:41
Near as I can figure it, some builds may mistakenly use the obsolete XSLTProcessor interface instead of the newer one. I've got Mozilla 1.2b, which *should* use the newer interfaces, but doesn't.
You can add variables and parameters to a stylesheet DOM using Javascript.

If, for instance,
 parameters = { foreground: "#FF0000", background: "#00FF00" };

  for ( pname in parameters )
  {
     var p = 
stylesheet.createElementNS("http://www.w3.org/1999/XSL/Transform","variable";);
     p.setAttribute("name", pname);
     p.appendChild(stylesheet.createTextNode( parameters[pname] ));
stylesheet.childNodes[1].insertBefore( p , stylesheet.childNodes[1].firstChild
        );
  }

This is sloppy, but I hope you get the idea. It doesn't check to see if there are any variables by the same name already defined in the stylesheet. (If they aren't already defined and you don't add them, it is an error which Transformix doesn't pick up on.) Also, childNodes[0] of the stylesheet is a text fragment; I don't know why or whether this is documented, but it doesn't seem right. It is probably whitespace.
juggy(_at_)gmx(_dot_)net wrote:

Hi Jarno,

Of course I meant XSLT implementation - sorry, that was a little bit misleading. :-) Thank you very much for the link. I have seen it before though and tried it out a little bit, but I didn't get it to work right. Do you know of an example of working code? I might be able to find out my mistakes that way.

Thanks!

Juggy

Jarno(_dot_)Elovirta(_at_)nokia(_dot_)com wrote:

Hi,


I am trying to
1.) combine several xml-files into 1
2.) pass a parameter to an xsl stylesheet
3.) select a certain node according to the stylesheet

(1) is working alright, but I just cannot seem to find a solution to (2). (3) should be easy afterwards. I usually use saxon/xalan for stuff like this, but in this case I would really rather have it done by the Mozilla rendering engine. I think I



You probably mean the XSLT implementation in Mozilla, not the rendering engine.


need to do some javascript tinkering or such - has anybody ever done something like this?



See
--

Jarno - Dulce Liquido: Disolucion

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




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





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



<Prev in Thread] Current Thread [Next in Thread>