XML XLS Problem

M

micu.radu

Hello,

Here is my problem,
I was trying to generate an html table from an xml file... the easy
method is to to use span an data src but this only works in IE so to
make it work in mozzila browsers I have made a different load for each
and used XSL for generatig the table:

XSL File
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:for-each select="PRODUSE/PRODUS">
<tr onmouseover="this.style.background='#fe9'"
onmouseout="this.style.background='#fff'">
<td class="lCell"><xsl:value-of select="NrCrt"/></td>
<td><xsl:value-of select="Denumire"/></td>
<td><xsl:value-of select="Reper"/></td>
<td><xsl:value-of select="Stocuri"/></td>
<td><xsl:value-of select="Pret"/></td>
</tr>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

The XML File
<?xml version="1.0"?>
<PRODUSE>
<PRODUS>
<NrCrt>1</NrCrt>
<Denumire>Cuzinet biela 87790328</Denumire>
<Reper>N\A</Reper>
<Stocuri>5</Stocuri>
<Pret>106.32</Pret>
<Link>#</Link>
</PRODUS>
</PRODUSE>

And the code...
<script type="text/javascript">
var isIE;
var isNav;
isIE = (navigator.appName == "Microsoft Internet Explorer");
isNav = (navigator.appName == "Netscape");
if (isIE)
{
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("produse/Produse.xml")
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("produse/Produse.xsl")
// Transform
document.write(xml.transformNode(xsl))
}
if (isNav)
{
//for mozilla/netscape
var processor = new XSLTProcessor();
var xslt = document.implementation.createDocument("", "", null);
xslt.async = false;
xslt.load("produse/Produse.xsl");
processor.importStylesheet(xslt);
var src_doc = document.implementation.createDocument("","", null);
src_doc.async = false;

src_doc.load("produse/Produse.xml");
var result = processor.transformToDocument(src_doc);
var xmls = new XMLSerializer();
var output = xmls.serializeToString(result);
document.write(output);
}
</script>

On my PC WORKS BEAUTIFULL but when I tryed it on my server booom on IE
works fine and on Firefox does't shows anythig

Why why... :)

Pls help me. I cant find the solution for this one.

Thx in advance.
 

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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top