function not working without alert

S

Sharon

Hi!
I have this function to add some parameters to my XSL and then
retransform my XML with it, resulting in a neatly filtered table. It
works great, but as soon as I take out the alert, it doesn't do
anything anymore, seemingly. This is the function:

function renderData(filterField, filterValue, mode)
{
try
{
var s=new ActiveXObject('MSXML2.FreeThreadedDOMDocument');
var x=document.XMLDocument;
if (x==null)
{
x=navigator.XMLDocument;
if (mode=="pos"){s.load("/lib/xtable/xTablepos.xsl")}
else if (mode=="neg"){s.load("/lib/xtable/xTableneg.xsl")};
}
else {
if (mode=="pos"){s.load("/lib/xtable/xTablepos.xsl")}
else if (mode=="neg"){s.load("/lib/xtable/xTableneg.xsl")};
}
with (new ActiveXObject('MSXML2.XSLTemplate'))
{
alert("here");
stylesheet=s;
with (createProcessor())
{
addParameter('field1',filterField);
addParameter('filter1',filterValue);
input=x;
transform();
with (document.open('text/html'))
{
write(output);
navigator.XMLDocument=x;
navigator.XSLDocument=s;
close();
}
}
}
}
catch(exception)
{
}
}

I know that the problem lies with loading the XSL, because the alert
only makes it work when it is placed either right before the "with(new
ActiveXObject...) statement or right after it, before the
stylesheet=s; statement. The extra time for the alert is obviously
needed to load the xsl, without that extra time nothing happens. Now I
want the thing to work WITHOUT the alert, does anyone know how I can
make sure the XSL loads properly and then continue with the rest of
the function? Hope someone can help me! Thanks, Sharon
 
J

Java script Dude

I have this function to add some parameters to my XSL and then
retransform my XML with it, resulting in a neatly filtered table. It
works great, but as soon as I take out the alert, it doesn't do
anything anymore, seemingly. This is the function:
</snip>

I can't tell by looking at the code but you may be able to debug this
further. Dumping to a console window is the best option for scripting
language testing.

If you have not tried this type of debugging with your code, do the
following:
Open a new window and do document writes to that new window from
points in your code. Dump any values, lengths etc into the output.

This will at least point you to where and when the problem is
happening.

JsD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,111
Latest member
KetoBurn
Top