List Info

Thread: Checking events in time intervals




Checking events in time intervals
country flaguser name
United States
2007-10-24 06:54:06
Hello,

I am experimenting with events. I am trying to start a
discussion
about concepts here, maybe someone has better or more
elegant ways of
doing what I want.

I am trying to execute a piece of code that checks for the
mouse
position and uses these values for a calculation.
However, calculating each time the moseMove event is fired
eats up a
lot of processing power (about 30% on a MBP 2.16GHz).
I am looking for a more or less elegant way to check for the
mouse
position 10 to 50 times a second, based on the users
settings on the
page.

I tried firing events manually but those didn't include the
correct
mouse information (only 0,0 as coordinates).

The solution I have so far is to either add/remove the mouse
event
with a timeout which just feels wrong to do or to set a
variable at
the end of the calculation that is unset on the end of a
timeout.

I hope to hear ideas from you.

Thanks,

Torsten


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Checking events in time intervals
user name
2007-10-24 10:32:41
 
 
 
hello Torsten
this is the easy way to use mouse positioning in all the browser..........long before when i m using the mouse poitioning problem then i came across the this solution it will met ur requirements........any other issue so let me know with some sample which u have tried then i will try to solve
 

<HTML&gt;
<HEAD>
<META NAME=";GENERATOR&quot; Content=&quot;Microsoft Visual Studio 6.0"&gt;
<TITLE></TITLE>
&lt;/HEAD>;
<BODY&gt;
<script>
if (document.layers ) { // Netscape
&nbsp;   document.captureEvents(Event.MOUSEMOVE);
&nbsp; &nbsp; document.onmousemove = captureMousePosition;
} else if (document.all) { // Internet Explorer
&nbsp;   document.onmousemove = captureMousePosition;
} else if (document.getElementById) { // Netcsape 6
 &nbsp;  document.onmousemove = captureMousePosition;
}


// Global variables
xMousePos = 0; // Horizontal position of the mouse on the screen
yMousePos = 0; // Vertical position of the mouse on the screen
xMousePosMax = 0; // Width of the page
yMousePosMax = 0; // Height of the page

function captureMousePosition(e) {
 &nbsp;  if (document.layers) {
 &nbsp; &nbsp;   ; xMousePos = e.pageX;
&nbsp;   ; &nbsp;  yMousePos = e.pageY;
&nbsp;   ; &nbsp;  xMousePosMax = window.innerWidth+window.pageXOffset;
 ; &nbsp; &nbsp; &nbsp; yMousePosMax = window.innerHeight+window.pageYOffset;
&nbsp; &nbsp; } else if (document.all) {
 &nbsp; &nbsp;   ; xMousePos = window.event.x+document.body.scrollLeft;
&nbsp; &nbsp;   ;  yMousePos = window.event.y+document.body.scrollTop;
&nbsp; &nbsp; &nbsp;   xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
  ; &nbsp; &nbsp;  yMousePosMax = document.body.clientHeight+document.body.scrollTop;
&nbsp; &nbsp; } else if (document.getElementById) {
 &nbsp; &nbsp;   ; // Netscape 6 behaves the same as Netscape 4 in this regard
 &nbsp;   ; &nbsp; xMousePos = e.pageX;
&nbsp;   ; &nbsp;  yMousePos = e.pageY;
&nbsp;   ; &nbsp;  xMousePosMax = window.innerWidth+window.pageXOffset;
 ; &nbsp; &nbsp; &nbsp; yMousePosMax = window.innerHeight+window.pageYOffset;
&nbsp; &nbsp; }
 &nbsp;  window.status = "xMousePos="; + xMousePos + ", yMousePos=" + yMousePos + ", xMousePosMax=" + xMousePosMax + ", yMousePosMax=" + yMousePosMax;
}
</script>
</BODY&gt;
</HTML>

 
 
 
 
 


 
On 10/24/07, Torsten M. Walter < twalter80googlemail.com">twalter80googlemail.com> wrote:

Hello,

I am experimenting with events. I am trying to start a discussion
about concepts here, maybe someone has better or more elegant ways of
doing what I want.

I am trying to execute a piece of code that checks for the mouse
position and uses these values for a calculation.
However, calculating each time the moseMove event is fired eats up a
lot of processing power (about 30% on a MBP 2.16GHz).
I am looking for a more or less elegant way to check for the mouse
position 10 to 50 times a second, based on the users settings on the
page.

I tried firing events manually but those didn't include the correct
mouse information (only 0,0 as coordinates).

The solution I have so far is to either add/remove the mouse event
with a timeout which just feels wrong to do or to set a variable at
the end of the calculation that is unset on the end of a timeout.

I hope to hear ideas from you.

Thanks,

Torsten

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JavaScript Forum"; group.
To post to this group, send email to JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Checking events in time intervals
country flaguser name
United States
2007-10-24 12:58:27
Hi Abhimanyu,

thanks for trying to help but you might have misread my
post.

I know perfectly well how to register and capture events.
I have a custom library for browser agnostic event
handling.

My mouse position function works perfectly:

var getMousePos = function(evt) {
	/**
	 * params: event evt
	 * returns: position object {left:n, top:n, x:n, y:n}
	 * x equals absolute screen position from the left of the
document
	 * y equals absolute screen position from the top of the
document
	 * note that the position is calculated RELATIVE TO THE
DOCUMENT,
	 * rather than relative to the window
	 */
	var e = (!evt) ? window.event : evt;
	var pos = {left:0, top:0,x:0, y:0};

	if (e.pageX || e.pageY) {
		pos.x = e.pageX;
		pos.y = e.pageY;
	}
	else if (e.clientX || e.clientY)	{
		pos.x = e.clientX + document.body.scrollLeft
		+ document.documentElement.scrollLeft;
		pos.y = e.clientY + document.body.scrollTop
		+ document.documentElement.scrollTop;
	}
	pos.left = pos.x;
	pos.top = pos.y;
	return pos;
 }



My script looks similar to this:

function shadeIt (pos) {
	// do lots of stuff here
}

function getMousePosition (e) {
    var pos = getMousePos(e);
	shadeIt(pos);
}

window.onload = function() {
	addEvent("mousemove", getMousePosition);
	// register more events
}

The addEvent() function is a custom helper function that
adds events
based on number of parameters and browser type and version.

var addEvent = function(a) {
	/**
	 * params: event, callback function
	 * params: event, callback function, element
	 * params: event, callback function, execute while
Active
	 * params: event, callback function, element, execute
while Active
	 * returns: void
	 * function can be called with different arguments.
	 * function automatically checks for browser and attaches
	 * the event appropriately
	 * events need to be passed by name without the
"on" part
	 * example "onMouseOver" is passed as
"mouseover"
	 */
	var evt; // the event
	var cb; // callback function
	var el; // element to receive the listener
	var wa; // execute while active?
	switch(arguments.length) {
		/*
		...
		*/
		default:
			alert("addEventnnNot enough arguments
provided!")
	}

	var client = checkBrowser();
	if (client) {
		el.addEventListener(evt, cb, wa);
	}
	else if (!client) {
		el.attachEvent("on"+evt, cb);
	}
}

var removeEvent = function(evt, cb, el, uc) {
	var client = checkBrowser();
	if (client) {
		el.removeEventListener(evt, cb, uc);
	}
	else if (!client) {
		el.detachEvent("on"+evt, cb);
	}
}

The point I was thinking about is the number of event
captures in a
given time.
You see that anytime I move the mouse lots of calculations
have to be
carried out.

My tought was to somehow limit the capturing of the mouse
position to
a limited number within a certain time (i.e. 25 times per
minute) so
the processor is free for other calculations that I want to
add to
this script as well.

Thanks,

Torsten

On Oct 24, 5:32 pm, "abhimanyu singh"
<er.abhima...gmail.com> wrote:
> hello *Torsten*
> *this is the easy way to use mouse positioning in all
the
> browser..........long before when i m using the mouse
poitioning problem
> then i came across the this solution it will met ur
requirements........any
> other issue so let me know with some sample which u
have tried then i will
> try to solve *
> **
>
> <HTML>
> <HEAD>
> <META NAME="GENERATOR"
Content="Microsoft Visual Studio 6.0">
> <TITLE></TITLE>
> </HEAD>
> <BODY>
> <script>
> if (document.layers) { // Netscape
>     document.captureEvents(Event.MOUSEMOVE);
>     document.onmousemove = captureMousePosition;} else
if (document.all) { // Internet Explorer
>
>     document.onmousemove = captureMousePosition;} else
if (document.getElementById) { // Netcsape 6
>
>     document.onmousemove = captureMousePosition;
>
> }
>
> // Global variables
> xMousePos = 0; // Horizontal position of the mouse on
the screen
> yMousePos = 0; // Vertical position of the mouse on the
screen
> xMousePosMax = 0; // Width of the page
> yMousePosMax = 0; // Height of the page
>
> function captureMousePosition(e) {
>     if (document.layers) {
>         xMousePos = e.pageX;
>         yMousePos = e.pageY;
>         xMousePosMax =
window.innerWidth+window.pageXOffset;
>         yMousePosMax =
window.innerHeight+window.pageYOffset;
>     } else if (document.all) {
>         xMousePos =
window.event.x+document.body.scrollLeft;
>         yMousePos =
window.event.y+document.body.scrollTop;
>         xMousePosMax =
document.body.clientWidth+document.body.scrollLeft;
>         yMousePosMax =
document.body.clientHeight+document.body.scrollTop;
>     } else if (document.getElementById) {
>         // Netscape 6 behaves the same as Netscape 4 in
this regard
>         xMousePos = e.pageX;
>         yMousePos = e.pageY;
>         xMousePosMax =
window.innerWidth+window.pageXOffset;
>         yMousePosMax =
window.innerHeight+window.pageYOffset;
>     }
>     window.status = "xMousePos=" + xMousePos
+ ", yMousePos=" + yMousePos +
> ", xMousePosMax=" + xMousePosMax + ",
yMousePosMax=" + yMousePosMax;}
>
> </script>
> </BODY>
> </HTML>
> **
>
> On 10/24/07, Torsten M. Walter <twalte...googlemail.com> wrote:
>
>
>
> > Hello,
>
> > I am experimenting with events. I am trying to
start a discussion
> > about concepts here, maybe someone has better or
more elegant ways of
> > doing what I want.
>
> > I am trying to execute a piece of code that checks
for the mouse
> > position and uses these values for a calculation.
> > However, calculating each time the moseMove event
is fired eats up a
> > lot of processing power (about 30% on a MBP
2.16GHz).
> > I am looking for a more or less elegant way to
check for the mouse
> > position 10 to 50 times a second, based on the
users settings on the
> > page.
>
> > I tried firing events manually but those didn't
include the correct
> > mouse information (only 0,0 as coordinates).
>
> > The solution I have so far is to either add/remove
the mouse event
> > with a timeout which just feels wrong to do or to
set a variable at
> > the end of the calculation that is unset on the
end of a timeout.
>
> > I hope to hear ideas from you.
>
> > Thanks,
>
> > Torsten


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "JavaScript Forum" group.
To post to this group, send email to
JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to
JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information
?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Checking events in time intervals
user name
2007-11-02 08:44:50
 
hello all,
&nbsp;
i m facing a serious probs now a days............
its seems easy but for me i found it difficult.........
i want to do transformation usig xsl and xml(adding parameter).
for IE its working fine but for other browser like-firefox,opera its not working.........
i m giving u my complete xml,xsl and transformation code....u only paste and check why it is not working for other browser.....and correct it and let me know......this is really a big challenege for us.....
 ;
what my openion:- the way we are adding&nbsp;parameter is going wrong..........
 
 //emp.xml
<?xml version=&quot;1.0&quot;?>
<;?xml-stylesheet type='text/xsl9; href='emp.xsl';?>
<employee>;

&nbsp; &nbsp; <employee1>
&nbsp; &nbsp; <first&gt;Abhimanyu</first>
   ; <last&gt;Singh</last>
 &nbsp;  <sex>;male</sex>
&nbsp; &nbsp; <dob>;5Aug1983&lt;/dob>
  ;  <lang&gt;Hindi</lang>
 &nbsp;  </employee1>

   ; <employee1>
&nbsp; &nbsp; <first&gt;Abhishek</first&gt;
 &nbsp;  <last&gt;Tyagi</last>
 &nbsp;  <sex>;male</sex>
&nbsp; &nbsp; <dob>;1Sep1983&lt;/dob>
  ;  <lang&gt;English&lt;/lang>
 &nbsp;  </employee1>
 &nbsp; 
 &nbsp;  <employee1>
&nbsp; &nbsp; <first&gt;Ajay</first>
  ;  <last&gt;Gupta</last>
 &nbsp;  <sex>;male</sex>
&nbsp; &nbsp; <dob>;4Nov1983&lt;/dob>
  ;  <lang&gt;marathi&lt;/lang>
 &nbsp;  </employee1>
 
&nbsp; &nbsp; <employee1>
&nbsp; &nbsp; <first&gt;Mukund&lt;/first>;
 &nbsp;  <last&gt;Gupta</last>
 &nbsp;  <sex>;male</sex>
&nbsp; &nbsp; <dob>;3Mar1981&lt;/dob>
  ;  <lang&gt;english&lt;/lang>
 &nbsp;  </employee1>

</employee> 

---------------------------------------------------------------------------------------------------------------------
&nbsp;
emp.xsl

 

<?

xml version=" 1.0"?>

&lt;

xsl:stylesheet version=" 1.0" xmlnssl=" http://www.w3.org/1999/XSL/Transform"

xmlns:PC="urn:PointCross-GenericFunctions" >

<

xsl:output method=" html"/>

&lt;

xsl:param name=" Title" />

&nbsp;

<;

xsl:template match=" /">

<;

html>

<;

body>

<;

h1>

<;

xsl:value-of select=" $Title"/>

&lt;/

h1>

<

table border=" 1">

<;

tr bgcolor=" #cccccc">

<;

th align=" left">

<;

xsl:value-of select=" PC:ColumnTitle(1)"/>

&lt;/

th>

<;

th align=" left">

<;

xsl:value-of select=" PC:ColumnTitle(2)"/>

&lt;/

th>

<;

th align=" left"><xsl:value-of select ="PC:ColumnTitle(3)"/>

&lt;/

th>

<;

th align=" left"><xsl:value-of select ="PC:ColumnTitle(4)"/>

&lt;/

th>

<;

th align=" left"><xsl:value-of select ="PC:ColumnTitle(5)"/>

&lt;/

th>

<;/

tr>

&nbsp;

<

xsl:for-each select=" employee/employee1">

<;

tr>

<;

td><xsl:value-of select="first"/></ td>

<;

td><xsl:value-of select="last"/></ td>

<;

td><xsl:value-of select="sex"/></ td>

<;

td><xsl:value-of select="dob"/></ td>

<;

td><xsl:value-of select="lang"/></ td>

<;/

tr>

<;/

xsl:for-each>

<;/

table>

<;/

body>

<;/

html>

<;/

xsl:template>

<;/

xsl:stylesheet>
--------------------------------------------------------------------------------------------------------------------------
 
emp.html
&nbsp;
 ;
 

<html>
<head >
<script type=";text/javascript">
function OrchGeneric(){
   ; this.ColumnTitle=_ColumnTitle;
}

function _ColumnTitle(Col){
&nbsp; &nbsp; var rtn="";
&nbsp; &nbsp; switch (Col){
&nbsp; &nbsp; &nbsp;   case 1:
 &nbsp; &nbsp; &nbsp;   ; &nbsp; rtn="First Name";
 &nbsp; &nbsp; &nbsp;   ; &nbsp; break;
&nbsp; &nbsp; &nbsp;   case 2:
 &nbsp; &nbsp; &nbsp;   ; &nbsp; rtn="Last name";
 &nbsp;   ; &nbsp; &nbsp; &nbsp; break;
&nbsp; &nbsp; &nbsp;   case 3:
 &nbsp; &nbsp; &nbsp;   ; &nbsp; rtn="Sex";
  ; &nbsp; &nbsp; &nbsp; &nbsp;  break;
&nbsp; &nbsp; &nbsp;   case 4:
 &nbsp;   ; &nbsp; &nbsp; &nbsp; rtn="DOB"
&nbsp;   ; &nbsp; &nbsp; &nbsp;  break;&nbsp;
 &nbsp; &nbsp; &nbsp;  default:
&nbsp;   ; &nbsp; &nbsp; &nbsp;  rtn="Lang";
 &nbsp;  } &nbsp; &nbsp;
 &nbsp;  return rtn;
}

var Orch=new OrchGeneric();

function loadXML()
{
 &nbsp; &nbsp; // code for IE

&nbsp; &nbsp;  if(window.ActiveXObject)
 &nbsp;   
 &nbsp; &nbsp;  {

 ; &nbsp; &nbsp;  try{
 &nbsp; &nbsp; &nbsp; var ClientXML = new ActiveXObject("Msxml2.FreeThreadedDOMDocument&quot;)
 &nbsp; &nbsp; &nbsp; ClientXML.async = false
&nbsp; &nbsp; &nbsp;  ClientXML.load("emp.xml&quot;)
 
 &nbsp; &nbsp; &nbsp; var ClientXSL = new ActiveXObject(" Msxml2.FreeThreadedDOMDocument&quot;)
 &nbsp; &nbsp; &nbsp; ClientXSL.async = false
 &nbsp; &nbsp; &nbsp; ClientXSL.load("emp.xsl&quot;)
 
  ; &nbsp; &nbsp; var xslTemplate=new ActiveXObject("Msxml2.XSLTemplate";)
 &nbsp; &nbsp; &nbsp; xslTemplate.stylesheet=ClientXSL
 &nbsp; &nbsp; &nbsp; var xslProcessor=xslTemplate.createProcessor
 
&nbsp; &nbsp;   ; xslProcessor.input=ClientXML ;
 &nbsp; &nbsp;   xslProcessor.addObject(Orch, "urn:PointCross-GenericFunctions" );
 &nbsp;   ;  xslProcessor.addParameter (&quot;Title&quot;, "Employee Record&quot;);
 &nbsp; &nbsp; &nbsp;
 
&nbsp; &nbsp; 
 &nbsp; &nbsp; &nbsp; xslProcessor.transform();
   ; &nbsp;  document.write(xslProcessor.output);
   ; &nbsp; &nbsp; //alert(xslProcessor.output);

 &nbsp; &nbsp; &nbsp; }catch(e){alert(e)}


 ; &nbsp;  }

 ;  // code for Mozilla, etc.
 ;
 &nbsp; else if(document.implementation && document.implementation.createDocument)

  ;  {
 &nbsp; &nbsp;  
 &nbsp;  try{
 ; &nbsp; var xslStylesheet;
   ; var myDOM;
&nbsp; &nbsp; var xmlDoc;
&nbsp; &nbsp; var xsltProcessor = new XSLTProcessor();
 &nbsp;  // load the xslt file, example1.xsl &nbsp; &nbsp; &nbsp; 
 &nbsp;  var myXMLHTTPRequest = new XMLHttpRequest();
&nbsp;   myXMLHTTPRequest.open("GET&quot;,";emp.xsl&quot;, false);
&nbsp; &nbsp; myXMLHTTPRequest.send(null);
&nbsp; &nbsp;
 &nbsp;  xslStylesheet = myXMLHTTPRequest.responseXML;
&nbsp; 
 &nbsp;  xsltProcessor.importStylesheet(xslStylesheet);

&nbsp; &nbsp; // load the xml file, example1.xml
 &nbsp;  myXMLHTTPRequest = new XMLHttpRequest();
&nbsp; &nbsp; myXMLHTTPRequest.open("GET&quot;,";emp.xml&quot;, false);
&nbsp; &nbsp; myXMLHTTPRequest.send(null);
&nbsp; &nbsp;
 &nbsp;  xmlDoc = myXMLHTTPRequest.responseXML;
 &nbsp;  xsltProcessor.setParameter(";urn:PointCross-GenericFunctions&quot;,";Title";,"&quot;);  
 &nbsp;  var ownerDocument=document.implementation.createDocument(&quot;", "test", null);
&nbsp;   var newFragment=xsltProcessor.transformToFragment(xmlDoc,document);
&nbsp;  
 &nbsp;  document.body.appendChild( newFragment);
 &nbsp; 
 &nbsp;  }catch(e){alert(e)}

   ; }

 ; &nbsp; else

&nbsp; &nbsp;   {
 &nbsp; &nbsp;   ; alert(&quot;your browser cannot handle this script&quot;);
   ; &nbsp; }
}
</script>&nbsp;
</head>
<body onload=&quot;loadXML()" >
</body>
&lt;/html>

----------------------------------------------------------------------------------------------------------------------------
 
please let me know if u encoumnter any issue....................
&nbsp;
&nbsp;
thanx and regards,
Abhimanyu Singh

 

--------------------------------------------------------------------------------------------------------------------


 
On 10/29/07, Torsten M. Walter < twalter80googlemail.com">twalter80googlemail.com> wrote:

Hey thanks for this tip.

I have considered all kinds of possibilities but haven't even thought
about using the date object.

Frankly I haven't used it a lot ever, it seems I should give it some
more attention.

Thanks a bunch.

On Oct 27, 2:00 am, Jambalaya < chris.ak...gmail.com"> chris.ak...gmail.com> wrote:
>; On Oct 26, 5:20 am, "Torsten M. Walter&quot; < twalte...googlemail.com">twalte...googlemail.com>
&gt; wrote:
>;
> > Thanks Jeff,
&gt;
> > I need to try this one out. I don't know how much overhead the
> > constant event adding and removing will cause.
>; > I still need to capture events fairly often, but not on such small
&gt; > increments as the browsers do by default.
&gt;
> Removing and adding event handlers often sounds processor intensive.
> Why not try something like:
>
> function getMousePosition (e) {
>&nbsp;  var thisRun = new Date();
&gt; &nbsp; if (thisRun - getMousePosition.lastRun > 30){
>&nbsp;   ; var pos = getMousePos(e);
>&nbsp;   ; shadeIt(pos);
>&nbsp; &nbsp;  getMousePosition.lastRun = thisRun;
&gt; &nbsp; }}
>
> getMousePosition.lastRun = new Date();
&gt;
> Now your processor intensive code won't fire until the first mousemove
> event 30 milliseconds ( 30fps) after the last execution.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JavaScript Forum"; group.
To post to this group, send email to JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: Checking events in time intervals
country flaguser name
Germany
2007-11-05 04:17:04
Hi,

I'd say a reason for nobody answering might be that you posted your query in the wrong topic. Namely in a topic about event handling.

I looked at the group and your messages aren't posted there. I'd suggest opening a new thread with your query.

On topic:

I have no big experience with XSLT, but after a couple of quick tests I have the following results.

- your syntax is odd:
It looks as if you are using a generator - which is fine - but the xslt document is not valid and fails therefor in Firefox.
removing all the leading spaces in quoted arguments gets rig of most of the problem.

- you are using XMLHTTPRequest to retrieve the XSLT. I think this is okay, but using document.implementation is shorter
var process = new XSLTProcessor();
var xslStylesheet = document.implementation.createDocument("", "", null);
xslStylesheet.async = false;
process.importStylesheet(xslStylesheet);

- the addObject function in IE you are using to process the Table header isn't present in the FF version.
I searched the web for something similar but couldn't find anything suitable.
I suggest putting the table header straight into the XSLT will solve the problem


Maybe that helps.


-- mozilla code from emp.html
try{
var myDOM;
var xmlDoc;
var process = new XSLTProcessor();       
var xslStylesheet = document.implementation.createDocument("", "", null);
xslStylesheet.async = false;
xslStylesheet.load("emp.xsl");
process.importStylesheet(xslStylesheet);

myXMLHTTPRequest = new XMLHttpRequest();
myXMLHTTPRequest.open("GET","emp.xml", false);
myXMLHTTPRequest.send(null);

xmlDoc = myXMLHTTPRequest.responseXML;
process.setParameter("urn:PointCross-GenericFunctions", "ColumnTitle" , Orch );
process.setParameter("urn:PointCross-GenericFunctions","Title","Employee Record");   
var newFragment = process.transformToFragment(xmlDoc, document);

document.body.appendChild( newFragment); 

}catch(e){alert(e)}

}



-- emp.xslt
<?xml version="1.0"?>
&lt;xsl:stylesheet version="1.0" xmlnssl="http://www.w3.org/1999/XSL/Transform" xmlns:PC="urn:PointCross-GenericFunctions">
<xsl:output method="html"/>
&lt;xsl:param name="Title" />
<;xsl:template match="/"&gt;
<html>
<;body>
<h1>
<xsl:value-of select="$Title"/>
</h1>;
<table border="1">

<tr bgcolor="#cccccc">
<th align="left"><xsl:value-of select="PC:ColumnTitle(1)"/>&lt;/th>
<th align="left"><xsl:value-of select="PC:ColumnTitle(2)"/>&lt;/th>
<th align="left"><xsl:value-of select="PC:ColumnTitle(3)"/>&lt;/th>
<th align="left"><xsl:value-of select="PC:ColumnTitle(4)"/>&lt;/th>
<th align="left"><xsl:value-of select="PC:ColumnTitle(5)"/>&lt;/th>
</tr&gt;

<xsl:for-each select="employee/employee1">
<tr&gt;
<td&gt;<xsl:value-of select="first"/>&lt;/td>
<td&gt;<xsl:value-of select="last"/><;/td>
<td&gt;<xsl:value-of select="sex"/></td>
<td&gt;<xsl:value-of select="dob"/></td>
<td&gt;<xsl:value-of select="lang"/><;/td>
</tr&gt;
</xsl:for-each&gt;
</table>
&lt;/body>
</html>
</xsl:template>
</xsl:stylesheet>


Regards,

Torsten Walter
__________________________________________________
3d-M |  Online and Offline Media
Zum Piepenkerl 2 | 49090 Osnabrück | Germany
__________________________________________________
__________________________________________________
email: ttwalter80gmail.com">ttwalter80gmail.com

On Nov 5, 2007, at 6:53 AM, abhimanyu singh wrote:

hello all,
can u help me with my pervious problem......................no comment on this probs

 
On 11/2/07, abhimanyu singh < er.abhimanyugmail.com">er.abhimanyugmail.com> wrote:
 
hello all,
 
i m facing a serious probs now a days............
its seems easy but for me i found it difficult.........
i want to do transformation usig xsl and xml(adding parameter).
for IE its working fine but for other browser like-firefox,opera its not working.........
i m giving u my complete xml,xsl and transformation code....u only paste and check why it is not working for other browser.....and correct it and let me know......this is really a big challenege for us.....
 
what my openion:- the way we are adding parameter is going wrong..........
 
 //emp.xml
<?xml version="1.0"?>
&lt;?xml-stylesheet type='text/xsl' href='emp.xsl'?>
&lt;employee>

    <employee1>
    <first&gt;Abhimanyu</first>
    <last&gt;Singh</last>
    <sex>;male</sex>
    <dob>;5Aug1983&lt;/dob>
    <lang&gt;Hindi</lang>
    </employee1>

    <employee1>
    <first&gt;Abhishek</first&gt;
    <last&gt;Tyagi</last>
    <sex>;male</sex>
    <dob>;1Sep1983&lt;/dob>
    <lang&gt;English&lt;/lang>
    </employee1>
   
    <employee1>
    <first&gt;Ajay</first>
    <last&gt;Gupta</last>
    <sex>;male</sex>
    <dob>;4Nov1983&lt;/dob>
    <lang&gt;marathi&lt;/lang>
    </employee1>
 
    <employee1>
    <first&gt;Mukund&lt;/first>;
    <last&gt;Gupta</last>
    <sex>;male</sex>
    <dob>;3Mar1981&lt;/dob>
    <lang&gt;english&lt;/lang>
    </employee1>

</employee> 

---------------------------------------------------------------------------------------------------------------------
 
emp.xsl

 

<?

xml version=" 1.0"?>

<

xsl:stylesheet version=" 1.0" xmlnssl=" http://www.w3.org/1999/XSL/Transform"

xmlns:PC="urn:PointCross-GenericFunctions" >

<

xsl:output method=" html"/>

<

xsl:param name=" Title" />
 

<

xsl:template match=" /">

<

html>

<

body>

<

h1>

<

xsl:value-of select=" $Title"/>

</

h1>

<

table border=" 1">

<

tr bgcolor=" #cccccc">

<

th align=" left">

<

xsl:value-of select=" PC:ColumnTitle(1)"/>

</

th>

<

th align=" left">

<

xsl:value-of select=" PC:ColumnTitle(2)"/>

</

th>

<

th align=" left"><xsl:value-of select ="PC:ColumnTitle(3)"/>

</

th>

<

th align=" left"><xsl:value-of select ="PC:ColumnTitle(4)"/>

</

th>

<

th align=" left"><xsl:value-of select ="PC:ColumnTitle(5)"/>

</

th>

</

tr>
 

<

xsl:for-each select=" employee/employee1">

<

tr>

<

td><xsl:value-of select="first"/></ td>

<

td><xsl:value-of select="last"/></ td>

<

td><xsl:value-of select="sex"/></ td>

<

td><xsl:value-of select="dob"/></ td>

<

td><xsl:value-of select="lang"/></ td>

</

tr>

</

xsl:for-each>

</

table>

</

body>

</

html>

</

xsl:template>

</

xsl:stylesheet>
--------------------------------------------------------------------------------------------------------------------------
 
emp.html
 
 
 

<html>
<head >
<script type="text/javascript">
function OrchGeneric(){
    this.ColumnTitle=_ColumnTitle;
}

function _ColumnTitle(Col){
    var rtn="";
    switch (Col){
        case 1:
            rtn="First Name";
            break;
        case 2:
            rtn="Last name";
            break;
        case 3:
            rtn="Sex";
            break;
        case 4:
            rtn="DOB"
            break; 
        default:
            rtn="Lang";
    }    
    return rtn;
}

var Orch=new OrchGeneric();

function loadXML()
{
     // code for IE

     if(window.ActiveXObject)
      
      {

       try{
       var ClientXML = new ActiveXObject("Msxml2.FreeThreadedDOMDocument")
       ClientXML.async = false
       ClientXML.load("emp.xml")
 
       var ClientXSL = new ActiveXObject(" Msxml2.FreeThreadedDOMDocument")
       ClientXSL.async = false
       ClientXSL.load("emp.xsl")
 
       var xslTemplate=new ActiveXObject("Msxml2.XSLTemplate")
       xslTemplate.stylesheet=ClientXSL
       var xslProcessor=xslTemplate.createProcessor
 
       xslProcessor.input=ClientXML ;
       xslProcessor.addObject(Orch, "urn:PointCross-GenericFunctions" );
       xslProcessor.addParameter ("Title", "Employee Record");
      
 
    
       xslProcessor.transform();
       document.write(xslProcessor.output);
        //alert(xslProcessor.output);

       }catch(e){alert(e)}


     }

   // code for Mozilla, etc.
 
   else if(document.implementation && document.implementation.createDocument)

    {
      
    try{
    var xslStylesheet;
    var myDOM;
    var xmlDoc;
    var xsltProcessor = new XSLTProcessor();
    // load the xslt file, example1.xsl       
    var myXMLHTTPRequest = new XMLHttpRequest();
    myXMLHTTPRequest.open("GET","emp.xsl", false);
    myXMLHTTPRequest.send(null);
   
    xslStylesheet = myXMLHTTPRequest.responseXML;
  
    xsltProcessor.importStylesheet(xslStylesheet);

    // load the xml file, example1.xml
    myXMLHTTPRequest = new XMLHttpRequest();
    myXMLHTTPRequest.open("GET","emp.xml", false);
    myXMLHTTPRequest.send(null);
   
    xmlDoc = myXMLHTTPRequest.responseXML;
    xsltProcessor.setParameter("urn:PointCross-GenericFunctions","Title","");  
    var ownerDocument=document.implementation.createDocument("", "test", null);
    var newFragment=xsltProcessor.transformToFragment(xmlDoc,document);
   
    document.body.appendChild( newFragment);
   
    }catch(e){alert(e)}

    }

    else

      {
        alert("your browser cannot handle this script");
      }
}
</script> 
</head>
<body onload="loadXML()" >
</body>
&lt;/html>

----------------------------------------------------------------------------------------------------------------------------
 
please let me know if u encoumnter any issue....................
 
 
thanx and regards,
Abhimanyu Singh

 

--------------------------------------------------------------------------------------------------------------------


 
On 10/29/07, Torsten M. Walter <googlemail.com" target="_blank">twalter80googlemail.com > wrote:

Hey thanks for this tip.

I have considered all kinds of possibilities but haven't even thought
about using the date object.

Frankly I haven't used it a lot ever, it seems I should give it some
more attention.

Thanks a bunch.

On Oct 27, 2:00 am, Jambalaya <gmail.com" target="_blank"> chris.ak...gmail.com> wrote:
>; On Oct 26, 5:20 am, "Torsten M. Walter" <googlemail.com" target="_blank">twalte...googlemail.com >
> wrote:
>;
> > Thanks Jeff,
>
> > I need to try this one out. I don't know how much overhead the
> > constant event adding and removing will cause.
>; > I still need to capture events fairly often, but not on such small
> > increments as the browsers do by default.
&gt;
> Removing and adding event handlers often sounds processor intensive.
> Why not try something like:
>
> function getMousePosition (e) {
>   var thisRun = new Date();
&gt;   if (thisRun - getMousePosition.lastRun > 30){
    var pos = getMousePos(e);
    shadeIt(pos);
>     getMousePosition.lastRun = thisRun;
&gt;   }}
>
> getMousePosition.lastRun = new Date();
&gt;
> Now your processor intensive code won't fire until the first mousemove
> event 30 milliseconds ( 30fps) after the last execution.








--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JavaScript Forum"; group.
To post to this group, send email to JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: Checking events in time intervals
country flaguser name
Germany
2007-11-05 05:39:46
I was just giving you a starting point.

Try to remove the header row completely from your xsl file and you'll see that it works.

The problem is obviously associatedwith the function to set the value of your columns names.
As I wrote earlier, try making the column names static and it works.

Regards,


Torsten Walter
__________________________________________________
3d-M |  Online and Offline Media
Zum Piepenkerl 2 | 49090 Osnabrück | Germany
__________________________________________________
__________________________________________________
email: ttwalter80gmail.com">ttwalter80gmail.com

On Nov 5, 2007, at 12:03 PM, abhimanyu singh wrote:

thanx Torsten
    ya i thats right i have submitted this query in wrong thread....
the solution which u have sended , giving no output plz check and let me know...
 
 
thanx
Abhimanyu singh

 



 
On 11/5/07, Torsten M. Walter < twalter80googlemail.com">twalter80googlemail.com> wrote:
Hi,

 
I'd say a reason for nobody answering might be that you posted your query in the wrong topic. Namely in a topic about event handling.

 
I looked at the group and your messages aren't posted there. I'd suggest opening a new thread with your query.

 
On topic:

 
I have no big experience with XSLT, but after a couple of quick tests I have the following results.

 
- your syntax is odd:
It looks as if you are using a generator - which is fine - but the xslt document is not valid and fails therefor in Firefox.
removing all the leading spaces in quoted arguments gets rig of most of the problem.

 
- you are using XMLHTTPRequest to retrieve the XSLT. I think this is okay, but using document.implementation is shorter
var process = new XSLTProcessor();
var xslStylesheet = document.implementation.createDocument("", "", null);
xslStylesheet.async = false;
process.importStylesheet(xslStylesheet);

 
- the addObject function in IE you are using to process the Table header isn't present in the FF version.
I searched the web for something similar but couldn't find anything suitable.
 
I suggest putting the table header straight into the XSLT will solve the problem
 

 

 
Maybe that helps.

 

 
-- mozilla code from emp.html
try{
var myDOM;
var xmlDoc;
var process = new XSLTProcessor();       
var xslStylesheet = document.implementation.createDocument("", "", null);
xslStylesheet.async = false;
xslStylesheet.load("emp.xsl");
process.importStylesheet(xslStylesheet);

 
myXMLHTTPRequest = new XMLHttpRequest();
myXMLHTTPRequest.open("GET","emp.xml", false);
myXMLHTTPRequest.send(null);

 
xmlDoc = myXMLHTTPRequest.responseXML;
process.setParameter("urn:PointCross-GenericFunctions", "ColumnTitle" , Orch );
process.setParameter("urn:PointCross-GenericFunctions","Title","Employee Record");   
var newFragment = process.transformToFragment(xmlDoc, document);

 
document.body.appendChild( newFragment); 

 
}catch(e){alert(e)}

 
}

 

 

 
-- emp.xslt
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlnssl="http://www.w3.org/1999/XSL/Transform " xmlns:PC="urn:PointCross-GenericFunctions">
<xsl:output method="html"/>
<xsl:param name="Title" />
<xsl:template match="/"&gt;
<html&gt;
<body&gt;
<h1>;
<xsl:value-of select="$Title"/>
</h1&gt;
<table border="1">

 
<tr bgcolor="#cccccc">
<th align="left"><xsl:value-of select="PC:ColumnTitle(1)"/>&lt;/th>
<th align="left"><xsl:value-of select="PC:ColumnTitle(2)"/>&lt;/th>
<th align="left"><xsl:value-of select="PC:ColumnTitle(3)"/>&lt;/th>
<th align="left"><xsl:value-of select="PC:ColumnTitle(4)"/>&lt;/th>
<th align="left"><xsl:value-of select="PC:ColumnTitle(5)"/>&lt;/th>
</tr&gt;

 
<xsl:for-each select="employee/employee1">
<tr>;
<td>;<xsl:value-of select="first"/>&lt;/td>
<td>;<xsl:value-of select="last"/><;/td>
<td>;<xsl:value-of select="sex"/></td>
<td>;<xsl:value-of select="dob"/></td>
<td>;<xsl:value-of select="lang"/><;/td>
</tr&gt;
</xsl:for-each>;
</table>
</body>
</html>
</xsl:template>;
</xsl:stylesheet&gt;

 

 
Regards,

 
Torsten Walter
__________________________________________________
3d-M |  Online and Offline Media
Zum Piepenkerl 2 | 49090 Osnabrück | Germany
__________________________________________________
__________________________________________________

On Nov 5, 2007, at 6:53 AM, abhimanyu singh wrote:

hello all,
can u help me with my pervious problem......................no comment on this probs

 
On 11/2/07, abhimanyu singh <gmail.com" target="_blank">er.abhimanyugmail.com > wrote:
 
hello all,
 
i m facing a serious probs now a days............
its seems easy but for me i found it difficult.........
i want to do transformation usig xsl and xml(adding parameter).
for IE its working fine but for other browser like-firefox,opera its not working.........
i m giving u my complete xml,xsl and transformation code....u only paste and check why it is not working for other browser.....and correct it and let me know......this is really a big challenege for us.....
 
what my openion:- the way we are adding parameter is going wrong..........
 
 //emp.xml
<?xml version="1.0"?>
&lt;?xml-stylesheet type='text/xsl' href='emp.xsl'?>
&lt;employee>

    <employee1>
    <first&gt;Abhimanyu</first>
    <last&gt;Singh</last>
    <sex>;male</sex>
    <dob>;5Aug1983&lt;/dob>
    <lang&gt;Hindi</lang>
    </employee1>

    <employee1>
    <first&gt;Abhishek</first&gt;
    <last&gt;Tyagi</last>
    <sex>;male</sex>
    <dob>;1Sep1983&lt;/dob>
    <lang&gt;English&lt;/lang>
    </employee1>
   
    <employee1>
    <first&gt;Ajay</first>
    <last&gt;Gupta</last>
    <sex>;male</sex>
    <dob>;4Nov1983&lt;/dob>
    <lang&gt;marathi&lt;/lang>
    </employee1>
 
    <employee1>
    <first&gt;Mukund&lt;/first>;
    <last&gt;Gupta</last>
    <sex>;male</sex>
    <dob>;3Mar1981&lt;/dob>
    <lang&gt;english&lt;/lang>
    </employee1>

</employee> 

---------------------------------------------------------------------------------------------------------------------
 
emp.xsl

 

<?

xml version=" 1.0"?>

<

xsl:stylesheet version=" 1.0" xmlnssl=" http://www.w3.org/1999/XSL/Transform"

 
xmlns:PC="urn:PointCross-GenericFunctions " >

 

<

xsl:output method=" html"/>

<

xsl:param name=" Title" />
 
 

<

xsl:template match=" /">

<

html>

<

body>

<

h1>

<

xsl:value-of select=" $Title"/>

</

h1>

 

<

table border=" 1">

<

tr bgcolor=" #cccccc">

<

th align=" left">

<

xsl:value-of select=" PC:ColumnTitle(1)"/>

</

th>

<

th align=" left">

<

xsl:value-of select=" PC:ColumnTitle(2)"/>

</

th>

<

th align=" left"><xsl:value-of select ="PC:ColumnTitle(3)"/>

</

th>

<

th align=" left"><xsl:value-of select ="PC:ColumnTitle(4)"/>

</

th>

<

th align=" left"><xsl:value-of select ="PC:ColumnTitle(5)"/>

</

th>

</

tr>
 
 

<

xsl:for-each select=" employee/employee1">

<

tr>

<

td><xsl:value-of select="first"/></ td>

<

td><xsl:value-of select="last"/></ td>

<

td><xsl:value-of select="sex"/></ td>

<

td><xsl:value-of select="dob"/></ td>

<

td><xsl:value-of select="lang"/></ td>

</

tr>

</

xsl:for-each>

</

table>

</

body>

</

html>

</

xsl:template>

</

xsl:stylesheet>
--------------------------------------------------------------------------------------------------------------------------
 
emp.html
 
 
 

<html>
<head >
<script type="text/javascript">
function OrchGeneric(){
    this.ColumnTitle=_ColumnTitle;
}

function _ColumnTitle(Col){
    var rtn="";
    switch (Col){
        case 1:
            rtn="First Name";
            break;
        case 2:
            rtn="Last name";
            break;
        case 3:
            rtn="Sex";
            break;
        case 4:
            rtn="DOB"
            break; 
        default:
            rtn="Lang";
    }    
    return rtn;
}

var Orch=new OrchGeneric();

function loadXML()
{
     // code for IE

     if(window.ActiveXObject)
      
      {

       try{
       var ClientXML = new ActiveXObject("Msxml2.FreeThreadedDOMDocument")
       ClientXML.async = false
       ClientXML.load("emp.xml")
 
       var ClientXSL = new ActiveXObject(" Msxml2.FreeThreadedDOMDocument")
       ClientXSL.async = false
       ClientXSL.load("emp.xsl")
 
       var xslTemplate=new ActiveXObject("Msxml2.XSLTemplate")
       xslTemplate.stylesheet=ClientXSL
       var xslProcessor=xslTemplate.createProcessor
 
       xslProcessor.input=ClientXML ;
       xslProcessor.addObject(Orch, "urn:PointCross-GenericFunctions" );
       xslProcessor.addParameter ("Title", "Employee Record");
      
 
    
       xslProcessor.transform();
       document.write(xslProcessor.output);
        //alert(xslProcessor.output);

       }catch(e){alert(e)}


     }

   // code for Mozilla, etc.
 
   else if(document.implementation && document.implementation.createDocument)

    {
      
    try{
    var xslStylesheet;
    var myDOM;
    var xmlDoc;
    var xsltProcessor = new XSLTProcessor();
    // load the xslt file, example1.xsl       
    var myXMLHTTPRequest = new XMLHttpRequest();
    myXMLHTTPRequest.open("GET","emp.xsl", false);
    myXMLHTTPRequest.send(null);
   
    xslStylesheet = myXMLHTTPRequest.responseXML;
  
    xsltProcessor.importStylesheet(xslStylesheet);

    // load the xml file, example1.xml
    myXMLHTTPRequest = new XMLHttpRequest();
    myXMLHTTPRequest.open("GET","emp.xml", false);
    myXMLHTTPRequest.send(null);
   
    xmlDoc = myXMLHTTPRequest.responseXML;
    xsltProcessor.setParameter("urn:PointCross-GenericFunctions","Title","");  
    var ownerDocument=document.implementation.createDocument("", "test", null);
    var newFragment=xsltProcessor.transformToFragment(xmlDoc,document);
   
    document.body.appendChild( newFragment);
   
    }catch(e){alert(e)}

    }

    else

      {
        alert("your browser cannot handle this script");
      }
}
</script> 
</head>
<body onload="loadXML()" >
</body>
&lt;/html>

----------------------------------------------------------------------------------------------------------------------------
 
please let me know if u encoumnter any issue....................
 
 
thanx and regards,
Abhimanyu Singh

 

--------------------------------------------------------------------------------------------------------------------


 
On 10/29/07, Torsten M. Walter <googlemail.com" target="_blank">twalter80googlemail.com > wrote:

Hey thanks for this tip.

I have considered all kinds of possibilities but haven't even thought
about using the date object.

Frankly I haven't used it a lot ever, it seems I should give it some
more attention.

Thanks a bunch.

On Oct 27, 2:00 am, Jambalaya <gmail.com" target="_blank"> chris.ak...gmail.com> wrote:
>; On Oct 26, 5:20 am, "Torsten M. Walter" <googlemail.com" target="_blank">twalte...googlemail.com >
> wrote:
>;
> > Thanks Jeff,
>
> > I need to try this one out. I don't know how much overhead the
> > constant event adding and removing will cause.
>; > I still need to capture events fairly often, but not on such small
> > increments as the browsers do by default.
&gt;
> Removing and adding event handlers often sounds processor intensive.
> Why not try something like:
>
> function getMousePosition (e) {
>   var thisRun = new Date();
&gt;   if (thisRun - getMousePosition.lastRun > 30){
    var pos = getMousePos(e);
    shadeIt(pos);
>     getMousePosition.lastRun = thisRun;
&gt;   }}
>
> getMousePosition.lastRun = new Date();
&gt;
> Now your processor intensive code won't fire until the first mousemove
> event 30 milliseconds ( 30fps) after the last execution.










--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JavaScript Forum"; group.
To post to this group, send email to JavaScript-Informationgooglegroups.com
To unsubscribe from this group, send email to JavaScript-Information-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/JavaScript-Information?hl=en
-~----------~----~----~----~------~----~------~--~---
Re: Checking events in time intervals
user name
2007-11-05 07:22:26
hello Torsten
&nbsp;  i have done what u said means remove the column name from the xslt but in IE its giving object error and in FF its not displaying any thing....
 
plz help me i m also not good in xslt.....but i need this stuff.....
 
regards
Abhimanyu Singh


 
On 11/5/07, abhimanyu singh < er.abhimanyugmail.com">er.abhimanyugmail.com> wrote:
hello
i have kept the column name static but its giving no error ;...
in IE also it is throwing error....................
 
thanx
abhimanyu singh

&nbsp;
On 11/5/07, Torsten M. Walter <googlemail.com" target="_blank">twalter80googlemail.com > wrote:
I was just giving you a starting point.

 
Try to remove the header row completely from your xsl file and you'll see that it works.

 
The problem is obviously associatedwith the function to set the value of your columns names.
As I wrote earlier, try making the column names static and it works.

 
Regards,


 ;
Torsten Walter
__________________________________________________
3d-M |  Online and Offline Media
Zum Piepenkerl 2 | 49090 Osnabrück | Germany
__________________________________________________
__________________________________________________

On Nov 5, 2007, at 12:03 PM, abhimanyu singh wrote:

thanx Torsten
&nbsp; &nbsp; ya i thats right i have submitted this query in wrong thread....
the solution which u have sended , giving no output plz check and let me know...
 
 
thanx
Abhimanyu singh

 



 
On 11/5/07, Torsten M. Walter <googlemail.com" target="_blank">twalter80googlemail.com > wrote:
Hi,

 
I'd say a reason for nobody answering might be that you posted your query in the wrong topic. Namely in a topic about event handling.

 
I looked at the group and your messages aren't posted there. I'd suggest opening a new thread with your query.

 
On topic:

 
I have no big experience with XSLT, but after a couple of quick tests I have the following results.

 
- your syntax is odd:
It looks as if you are using a generator - which is fine - but the xslt document is not valid and fails therefor in Firefox.
removing all the leading spaces in quoted arguments gets rig of most of the problem.

 
- you are using ;XMLHTTPRequest to retrieve the XSLT. I think this is okay, but using document.implementation is shorter
var process = new XSLTProcessor();
var xslStylesheet = document.implementation.createDocument(&quot;", "&quot;, null);
xslStylesheet.async = false;
process.importStylesheet(xslStylesheet);

 
- the addObject function in IE you are using to process the Table header isn't present in the FF version.
I searched the web for something similar but couldn';t find anything suitable.
 
I suggest putting the table header straight into the XSLT will solve the problem
&nbsp;

&nbsp;

&nbsp;
Maybe that helps.

 

 
-- mozilla code from emp.html
try{
var myDOM;
var xmlDoc;
var process = new XSLTProcessor();      &nbsp;
var xslStylesheet = document.implementation.createDocument(&quot;", "&quot;, null);
xslStylesheet.async = false;
xslStylesheet.load(&quot;emp.xsl");
process.importStylesheet(xslStylesheet);

 
myXMLHTTPRequest = new XMLHttpRequest();
myXMLHTTPRequest.open("GET",&quot;emp.xml&quot;, false);
myXMLHTTPRequest.send(null);

 
xmlDoc = myXMLHTTPRequest.responseXML;
process.setParameter("urn:PointCross-GenericFunctions&quot;, "ColumnTitle&quot; , Orch );
process.setParameter("urn:PointCross-GenericFunctions&quot;,"Title",&quot;Employee Record&quot;);  &nbsp;
var newFragment = process.transformToFragment(xmlDoc, document);

 ;
document.body.appendChild( newFragment); 

 
}catch(e){alert(e)}

 
}

&nbsp;

&nbsp;

&nbsp;
-- emp.xslt
<?xml version=&quot;1.0&quot;?>
<xsl:stylesheet version=&quot;1.0&quot; xmlnssl="http://www.w3.org/1999/XSL/Transform " xmlns:PC=&quot;urn:PointCross-GenericFunctions">
<;xsl:output method=&quot;html&quot;/>
<xsl:param name=";Title"; />
&lt;xsl:template match=&quot;/"&gt;
<html>
<body>;
<h1>
<;xsl:value-of select=&quot;$Title&quot;/>
</h1&gt;
<table border=&quot;1"&gt;

&nbsp;
<tr bgcolor=&quot;#cccccc">
<th align=&quot;left";><xsl:value-of select=&quot;PC:ColumnTitle(1)&quot;/>&lt;/th>
<th align=&quot;left";><xsl:value-of select=&quot;PC:ColumnTitle(2)&quot;/>&lt;/th>
<th align=&quot;left";><xsl:value-of select=&quot;PC:ColumnTitle(3)&quot;/>&lt;/th>
<th align=&quot;left";><xsl:value-of select=&quot;PC:ColumnTitle(4)&quot;/>&lt;/th>
<th align=&quot;left";><xsl:value-of select=&quot;PC:ColumnTitle(5)&quot;/>&lt;/th>
</tr&gt;

&nbsp;
<xsl:for-each select=&quot;employee/employee1&quot;>
<tr>;
<td>;<xsl:value-of select=&quot;first&quot;/><;/td>
<td>;<xsl:value-of select=&quot;last&quot;/></td>
<td>;<xsl:value-of select=&quot;sex";/></td>