Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - My xslt works in Firefox and not IE6.0 >Thread Next - Re: My xslt works in Firefox and not IE6.0 Re: My xslt works in Firefox and not IE6.0To: NULL Date: 12/10/2005 5:25:00 PM This is a multi-part message in MIME format.
------=_NextPart_000_007D_01C5FDAE.9B589DA0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
You need to change the progid to new =
ActiveXObject("MSXML2.DOMDocument");
In IE6 you can also just change your XML file to have this at the top:
<?xml-stylesheet href=3D"test.xsl" type=3D"text/xsl"?>
then launch the XML file and get the result you are looking for. But =
if you have to run script, there is a better way to do it in IE6. You =
can put the XML and XSL in an XML data island which allows IE to manage =
the downloading (which is faster) and then when you get the onload event =
you run the transform as follows:
<body>
<xml src=3D"StatsReport_allstats.xml" id=3D"XML"></xml>
<xml src=3D"NodeStats2.xsl" id=3D"XSL"></xml>
<script for=3D"window" event=3D"onload" language=3D"javascript">
var isIE =3D (navigator.appName =3D=3D "Microsoft Internet =
Explorer");
var isNav =3D (navigator.appName =3D=3D "Netscape");
if (isIE)
{=20
// Transform
document.write(XSL.transformNode(XML.XMLDocument))
} else {
...
PS: you don't need: xmlns:xsl=3D"http://www/w3.org/1999/XSL/Transform" =
in your XML file.
<meena.shah@g...> wrote in message =
news:1134158233.165541.101030@g......
>I was trying to get my xsl file to work in Firefox, which I did, but
> now it seems it doesn't work at all in IE6.0. I thought 6.0 used the
> same standard as Firefox?
>=20
> below is the js used to load the page:
>=20
> <script type=3D"text/javascript">
> var isIE;
> var isNav;
> isIE =3D (navigator.appName =3D=3D "Microsoft
> Internet Explorer");
> isNav =3D (navigator.appName =3D=3D =
"Netscape");
>=20
> if (isIE)
> {
> // Load XML
> var xml =3D new
> ActiveXObject("Microsoft.XMLDOM")
> xml.async =3D false
> xml.load("StatsReport_allstats.xml")
>=20
> // Load XSL
> var xsl =3D new
> ActiveXObject("Microsoft.XMLDOM")
> xsl.async =3D false
> xsl.load("NodeStats2.xsl")
>=20
> // Transform
> document.write(xml.transformNode(xsl))
> }
> if (isNav)
> {
> //for mozilla/netscape
> var processor =3D new XSLTProcessor();
> var xslt =3D
> document.implementation.createDocument("", "", null);
> xslt.async =3D false;
> xslt.load("NodeStats2.xsl");
> processor.importStylesheet(xslt);
>=20
> var src_doc =3D
> document.implementation.createDocument("","", null);
> src_doc.async =3D false;
>=20
> src_doc.load("StatsReport_allstats.xml");
> var result =3D
> processor.transformToDocument(src_doc);
> var xmls =3D new XMLSerializer();
> var output =3D
> xmls.serializeToString(result);
> document.write(output);
> alert("done");
> }
>=20
> </script>
>=20
> I stuck a few alerts into the IE code, so I know the transform is
> what's failing.
> This is my stylesheet tag in my xsl:
> <xsl:stylesheet version=3D"1.0"
>=20
> xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
> xmlns:ns1=3D"schema:StatsReportSchema.xml">
>=20
> 6.0 sp2 would load fine with the working draft:
> <xsl:stylesheet version=3D"1.0" =
xmlns:xsl=3D"http://www.w3.org/TR/WD-xsl">
>=20
> To have this work in both IE and Firefox do I have to duplicate my =
code
> for both versions of xsl (that would be the only workaround I can =
think
> of)? It still seems like really this ought to work for both, if they
> both support the same versions. Do I need an IE update? Or is there
> no way to have the same xsl stuff work for both and I really do just
> need to duplicate everything for both browsers?
>=20
> For extra clarity.. here is a simplified xml of what i'm using:
> <?xml version=3D"1.0" encoding=3D"utf-8"?>
> <StatsReport xmlns=3D"schema:StatsReportSchema.xml"
> xmlns:xsl=3D"http://www/w3.org/1999/XSL/Transform">
> <NodeStatistics Version=3D"1.0">
> <Summary>
> <TimeSaved>11/30/2005 15:08:00</TimeSaved>
> <Packets>165</Packets>
> <Bytes>20243</Bytes>
> <NodeCount>55</NodeCount>
> </Summary>
> <Stats>
> <NodeStat>
> <Addr>00:06:5B:97:37:CF</Addr>
> <PacketsSent>4</PacketsSent>
> <BytesSent>508</BytesSent>
> <PacketsReceived>0</PacketsReceived>
> <BytesReceived>0</BytesReceived>
> </NodeStat>
> <NodeStat>
> <Addr>FF:FF:FF:FF:FF:FF</Addr>
> <PacketsSent>0</PacketsSent>
> <BytesSent>0</BytesSent>
> <PacketsReceived>120</PacketsReceived>
> <BytesReceived>13693</BytesReceived>
> </NodeStat>
> <NodeStat>
> <Addr>00:40:80:76:50:00</Addr>
> <PacketsSent>41</PacketsSent>
> <BytesSent>6180</BytesSent>
> <PacketsReceived>4</PacketsReceived>
> <BytesReceived>1557</BytesReceived>
> </NodeStat>
> </Stats>
> </NodeStatistics>
> </StatsReport>
>=20
> and here is my simplified xsl file:
> <?xml version=3D"1.0" encoding=3D"ISO-8859-1" ?>
> <xsl:stylesheet version=3D"1.0"
> xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"
> xmlns:ns1=3D"schema:StatsReportSchema.xml">
> <xsl:output
> method=3D"html"
> version=3D"4.0"
> omit-xml-declaration=3D"yes"
> indent=3D"yes"
> encoding=3D"iso-8859-1"
> media-type=3D"text/html"/>
>=20
> <!-- Root template -->
> <xsl:template match=3D"/">
> <html>
> <head>
> <title>Node Statistics</title>
> <link href=3D"StatsReport2.css" type=3D"text/css" rel=3D"stylesheet"/>
> </head>
> <body>
> <xsl:apply-templates select=3D"ns1:StatsReport"/><br/>
> </body>
> </html>
> </xsl:template>
>=20
>=20
> another quick question for you xsl gurus out there:
> with the following structure:
> StatsReport
> --NodeStatistics
> ----Summary
> ------Bytes
> ----Stats
> ------NodeStat
> --------BytesSent
> --------BytesReceived
>=20
> I'm trying to access my Bytes node from inside a template for =
NodeStat,
> a line like this:
> <td class=3D"rr"><xsl:value-of select=3D"format-number((ns1:BytesSent =
div
> ns1:StatsReport/NodeStatistics/Summary/Bytes), '##0.000%')"/>
> I always get a NaN as a result. If I try to just select that node =
from
> this template using the absolute path I get an empty result. Is there
> a way I can access my Bytes node value from inside the NodeStat
> template?
>=20
> Thanks!
>
------=_NextPart_000_007D_01C5FDAE.9B589DA0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2769" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff background=3D"">
<DIV><FONT face=3DArial size=3D2>You need to change the progid to new=20
ActiveXObject("MSXML2.DOMDocument");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>In IE6 you can also just change your =
XML file to=20
have this at the top:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2><FONT color=3D#0000ff size=3D2>
<P><?</FONT><FONT color=3D#800000 size=3D2>xml-stylesheet</FONT><FONT =
color=3D#0000ff size=3D2> </FONT><FONT color=3D#808080 =
size=3D2>href=3D"test.xsl"=20
type=3D"text/xsl"</FONT><FONT color=3D#0000ff size=3D2>?></FONT></P>
<P><FONT size=3D2>then launch the XML file and get the result you =
are=20
looking for. B</FONT>ut if you have to run script, there is a =
better way=20
to do it in IE6. You can put the XML and XSL in an XML data island =
which=20
allows IE to manage the downloading (which is faster) and then when you =
get the=20
onload event you run the transform as follows:</FONT></P></DIV>
<DIV><FONT face=3DArial size=3D2><FONT color=3D#0000ff size=3D2>
<P><</FONT><FONT color=3D#800000 size=3D2>body</FONT><FONT =
color=3D#0000ff=20
size=3D2>><BR> </FONT><FONT color=3D#0000ff><FONT=20
size=3D2><</FONT></FONT><FONT color=3D#800000 =
size=3D2>xml</FONT><FONT size=3D2>=20
</FONT><FONT color=3D#ff0000 size=3D2>src</FONT><FONT color=3D#0000ff=20
size=3D2>=3D"StatsReport_allstats.xml"</FONT><FONT size=3D2> =
</FONT><FONT=20
color=3D#ff0000 size=3D2>id</FONT><FONT color=3D#0000ff=20
size=3D2>=3D"XML"></</FONT><FONT color=3D#800000 =
size=3D2>xml</FONT><FONT=20
color=3D#0000ff size=3D2>><BR> </FONT><FONT =
color=3D#0000ff=20
size=3D2><</FONT><FONT color=3D#800000 size=3D2>xml</FONT><FONT =
size=3D2>=20
</FONT><FONT color=3D#ff0000 size=3D2>src</FONT><FONT color=3D#0000ff=20
size=3D2>=3D"NodeStats2.xsl"</FONT><FONT size=3D2> </FONT><FONT =
color=3D#ff0000=20
size=3D2>id</FONT><FONT color=3D#0000ff =
size=3D2>=3D"XSL"></</FONT><FONT=20
color=3D#800000 size=3D2>xml</FONT><FONT color=3D#0000ff=20
size=3D2>><BR> </FONT><FONT color=3D#0000ff=20
size=3D2><</FONT><FONT color=3D#800000 size=3D2>script</FONT><FONT =
size=3D2>=20
</FONT><FONT color=3D#ff0000 size=3D2>for</FONT><FONT color=3D#0000ff=20
size=3D2>=3D"window"</FONT><FONT size=3D2> </FONT><FONT color=3D#ff0000=20
size=3D2>event</FONT><FONT color=3D#0000ff =
size=3D2>=3D"onload"</FONT><FONT size=3D2>=20
</FONT><FONT color=3D#ff0000 size=3D2>language</FONT><FONT =
color=3D#0000ff=20
size=3D2>=3D"javascript"></FONT><FONT=20
size=3D2><BR> <FONT=20
color=3D#0000ff>var</FONT><FONT size=3D2> </FONT>isIE =3D =
(navigator.appName =3D=3D=20
</FONT><FONT color=3D#800000 size=3D2>"Microsoft Internet =
Explorer"</FONT><FONT=20
size=3D2>);<BR> <FONT =
color=3D#0000ff=20
size=3D2>var</FONT><FONT size=3D2> </FONT>isNav =3D (navigator.appName =
=3D=3D </FONT><FONT=20
color=3D#800000 size=3D2>"Netscape"</FONT><FONT=20
size=3D2>);<BR></FONT> <FONT=20
color=3D#0000ff size=3D2>if</FONT><FONT size=3D2>=20
(isIE)<BR> {=20
<BR> =20
</FONT><FONT color=3D#008000 size=3D2>// Transform<BR><FONT=20
color=3D#000000> &nb=
sp; =20
</FONT></FONT><FONT=20
size=3D2>document.write(XSL.transformNode(XML.XMLDocument))<BR> &nbs=
p; =20
} else =
{<BR> =20
...</FONT><FONT size=3D2><BR></FONT></FONT><BR><BR><FONT face=3DArial =
size=3D2>PS: you=20
don't need: xmlns:xsl=3D"http://www/w3.org/1999/XSL/Transform" in your =
XML=20
file.</FONT></P><FONT face=3DArial size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>
<P> </P>
<P><BR><BR><meena.shah@g...> wrote in message=20
news:1134158233.165541.101030@g......<BR>>I =
was=20
trying to get my xsl file to work in Firefox, which I did, but<BR>> =
now it=20
seems it doesn't work at all in IE6.0. I thought 6.0 used =
the<BR>> same=20
standard as Firefox?<BR>> <BR>> below is the js used to load the=20
page:<BR>> <BR>> =
<script=20
type=3D"text/javascript"><BR>> &=
nbsp; =20
var=20
isIE;<BR>> =
=20
var=20
isNav;<BR>>  =
; =
=20
isIE =3D (navigator.appName =3D=3D "Microsoft<BR>> Internet=20
Explorer");<BR>> =
&=
nbsp; =20
isNav =3D (navigator.appName =3D=3D "Netscape");<BR>>=20
<BR>>  =
; =
=20
if=20
(isIE)<BR>>  =
; =
=20
{<BR>> &nbs=
p;  =
; =20
// Load=20
XML<BR>> &n=
bsp; &nb=
sp; =20
var xml =3D new<BR>>=20
ActiveXObject("Microsoft.XMLDOM")<BR>> &n=
bsp; &nb=
sp; &nbs=
p; =20
xml.async =3D=20
false<BR>> =
&=
nbsp; =20
xml.load("StatsReport_allstats.xml")<BR>>=20
<BR>>  =
; =
=20
// Load=20
XSL<BR>> &n=
bsp; &nb=
sp; =20
var xsl =3D new<BR>>=20
ActiveXObject("Microsoft.XMLDOM")<BR>> &n=
bsp; &nb=
sp; &nbs=
p; =20
xsl.async =3D=20
false<BR>> =
&=
nbsp; =20
xsl.load("NodeStats2.xsl")<BR>>=20
<BR>>  =
; =
=20
//=20
Transform<BR>> &n=
bsp; &nb=
sp; =20
document.write(xml.transformNode(xsl))<BR>> &nb=
sp; &nbs=
p; =20
}<BR>> &nbs=
p;  =
;=20
if=20
(isNav)<BR>> &nbs=
p;  =
; =20
{<BR>> &nbs=
p;  =
; =20
//for=20
mozilla/netscape<BR>> &=
nbsp; &n=
bsp; =20
var processor =3D new=20
XSLTProcessor();<BR>> &=
nbsp; &n=
bsp; =20
var xslt =3D<BR>> document.implementation.createDocument("", "",=20
null);<BR>>  =
; =
=20
xslt.async =3D=20
false;<BR>>  =
; =
=20
xslt.load("NodeStats2.xsl");<BR>> &=
nbsp; &n=
bsp; &nb=
sp;=20
processor.importStylesheet(xslt);<BR>>=20
<BR>>  =
; =
=20
var src_doc =3D<BR>> document.implementation.createDocument("","",=20
null);<BR>>  =
; =
=20
src_doc.async =3D false;<BR>> <BR>>=20
src_doc.load("StatsReport_allstats.xml");<BR>> =
&=
nbsp; &n=
bsp; =20
var result =3D<BR>>=20
processor.transformToDocument(src_doc);<BR>> &n=
bsp; &nb=
sp; &nbs=
p; =20
var xmls =3D new=20
XMLSerializer();<BR>> &=
nbsp; &n=
bsp; =20
var output =3D<BR>>=20
xmls.serializeToString(result);<BR>> &nbs=
p;  =
; =
=20
document.write(output);<BR>> =
&=
nbsp; =20
alert("done");<BR>> &nb=
sp; &nbs=
p; =20
}<BR>> <BR>> =20
</script><BR>> <BR>> I stuck a few alerts into the IE code, =
so I=20
know the transform is<BR>> what's failing.<BR>> This is my =
stylesheet tag=20
in my xsl:<BR>> <xsl:stylesheet version=3D"1.0"<BR>> <BR>>=20
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"<BR>> &nb=
sp; &nbs=
p;=20
xmlns:ns1=3D"schema:StatsReportSchema.xml"><BR>> <BR>> 6.0 sp2 =
would load=20
fine with the working draft:<BR>> <xsl:stylesheet version=3D"1.0"=20
xmlns:xsl=3D"http://www.w3.org/TR/WD-xsl"><BR>> <BR>> To have =
this work=20
in both IE and Firefox do I have to duplicate my code<BR>> for both =
versions=20
of xsl (that would be the only workaround I can think<BR>> of)? =
It=20
still seems like really this ought to work for both, if they<BR>> =
both=20
support the same versions. Do I need an IE update? Or is=20
there<BR>> no way to have the same xsl stuff work for both and I =
really do=20
just<BR>> need to duplicate everything for both browsers?<BR>> =
<BR>>=20
For extra clarity.. here is a simplified xml of what i'm using:<BR>> =
<?xml=20
version=3D"1.0" encoding=3D"utf-8"?><BR>> <StatsReport=20
xmlns=3D"schema:StatsReportSchema.xml"<BR>>=20
xmlns:xsl=3D"http://www/w3.org/1999/XSL/Transform"><BR>> =
<NodeStatistics=20
Version=3D"1.0"><BR>> <Summary><BR>> =
<TimeSaved>11/30/2005=20
15:08:00</TimeSaved><BR>> =
<Packets>165</Packets><BR>>=20
<Bytes>20243</Bytes><BR>>=20
<NodeCount>55</NodeCount><BR>> </Summary><BR>>=20
<Stats><BR>> <NodeStat><BR>>=20
<Addr>00:06:5B:97:37:CF</Addr><BR>>=20
<PacketsSent>4</PacketsSent><BR>>=20
<BytesSent>508</BytesSent><BR>>=20
<PacketsReceived>0</PacketsReceived><BR>>=20
<BytesReceived>0</BytesReceived><BR>> =
</NodeStat><BR>>=20
<NodeStat><BR>> =
<Addr>FF:FF:FF:FF:FF:FF</Addr><BR>>=20
<PacketsSent>0</PacketsSent><BR>>=20
<BytesSent>0</BytesSent><BR>>=20
<PacketsReceived>120</PacketsReceived><BR>>=20
<BytesReceived>13693</BytesReceived><BR>>=20
</NodeStat><BR>> <NodeStat><BR>>=20
<Addr>00:40:80:76:50:00</Addr><BR>>=20
<PacketsSent>41</PacketsSent><BR>>=20
<BytesSent>6180</BytesSent><BR>>=20
<PacketsReceived>4</PacketsReceived><BR>>=20
<BytesReceived>1557</BytesReceived><BR>>=20
</NodeStat><BR>> </Stats><BR>> =
</NodeStatistics><BR>>=20
</StatsReport><BR>> <BR>> and here is my simplified xsl=20
file:<BR>> <?xml version=3D"1.0" encoding=3D"ISO-8859-1" =
?><BR>>=20
<xsl:stylesheet version=3D"1.0"<BR>>=20
xmlns:xsl=3D"http://www.w3.org/1999/XSL/Transform"<BR>> &nb=
sp; &nbs=
p;=20
xmlns:ns1=3D"schema:StatsReportSchema.xml"><BR>> =
<xsl:output<BR>>=20
method=3D"html"<BR>> version=3D"4.0"<BR>> =
omit-xml-declaration=3D"yes"<BR>>=20
indent=3D"yes"<BR>> encoding=3D"iso-8859-1"<BR>>=20
media-type=3D"text/html"/><BR>> <BR>> <!-- Root template=20
--><BR>> <xsl:template match=3D"/"><BR>> =
<html><BR>>=20
<head><BR>> <title>Node Statistics</title><BR>> =
<link=20
href=3D"StatsReport2.css" type=3D"text/css" =
rel=3D"stylesheet"/><BR>>=20
</head><BR>> <body><BR>> <xsl:apply-templates=20
select=3D"ns1:StatsReport"/><br/><BR>> </body><BR>> =
</html><BR>> </xsl:template><BR>> <BR>> <BR>> =
another=20
quick question for you xsl gurus out there:<BR>> with the following=20
structure:<BR>> StatsReport<BR>> --NodeStatistics<BR>>=20
----Summary<BR>> ------Bytes<BR>> ----Stats<BR>> =
------NodeStat<BR>>=20
--------BytesSent<BR>> --------BytesReceived<BR>> <BR>> I'm =
trying to=20
access my Bytes node from inside a template for NodeStat,<BR>> a line =
like=20
this:<BR>> <td class=3D"rr"><xsl:value-of=20
select=3D"format-number((ns1:BytesSent div<BR>>=20
ns1:StatsReport/NodeStatistics/Summary/Bytes), '##0.000%')"/><BR>> =
I=20
always get a NaN as a result. If I try to just select that node=20
from<BR>> this template using the absolute path I get an empty =
result. =20
Is there<BR>> a way I can access my Bytes node value from inside the=20
NodeStat<BR>> template?<BR>> <BR>>=20
Thanks!<BR>></FONT></P></DIV></BODY></HTML>
------=_NextPart_000_007D_01C5FDAE.9B589DA0--
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
