Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML and FireFox

Status
Not open for further replies.

hoss1524

Programmer
Apr 13, 2005
5
US
I'm having a problem creating a website in Firefox. The second part of the Javascript code works fine in IE, but the top half does not display the xml in Firefox. I have tried a lot of other suggestions, but it never seems to work. If anyone can help it would be very helpful.

JAVASCRIPT CODE
----------------------------
function init() {
var xslDoc;
var xslApplyID;
var xmlDoc;

//Code for FireFox
if (window.XMLHttpRequest)
{
xmlDoc=document.implementation.createDocument("", "", null);

xslDoc=document.implementation.createDocument("", "", null);

xslApplyID=document.implementation.createDocument("", "", null);

xslDoc.load("tree/tree.xslt");
xslApplyID.load("admin/applyID.xslt");

xmlDoc.load("tree/tree1.xml");
xmlDoc.loadXML(xmlDoc.documentElement.transformNode(xslApplyID));
document.getElementById('folderTree1').innerHTML = xmlDoc.documentElement.transformToDocumentNode(xslDoc);

xmlDoc.load("tree/tree2.xml");
xmlDoc.loadXML(xmlDoc.documentElement.transformNode(xslApplyID));
document.getElementById('folderTree2').innerHTML = xmlDoc.xmlDoc.documentElement.transformNode(xslDoc);
}
//Code for IE
else if (window.ActiveXObject)
{
xmlDoc = new ActiveXObject('MSXML2.DOMDocument');
xmlDoc.async = false;

xslDoc = new ActiveXObject('MSXML2.DOMDocument');
xslDoc.async = false;

xslApplyID = new ActiveXObject('MSXML2.DOMDocument');
xslApplyID.async = false;

xslDoc.load("tree/tree.xslt");
xslApplyID.load("admin/applyID.xslt");

xmlDoc.load("tree/tree1.xml");
xmlDoc.loadXML(xmlDoc.documentElement.transformNode(xslApplyID));
folderTree1.innerHTML = xmlDoc.documentElement.transformNode(xslDoc);

xmlDoc.load("tree/tree2.xml");
xmlDoc.loadXML(xmlDoc.documentElement.transformNode(xslApplyID));
folderTree2.innerHTML = xmlDoc.documentElement.transformNode(xslDoc);
}
}

XSLT Code
---------------------------
<xsl:stylesheet version="1.0" xmlns:xsl=" xmlns:dt="urn:schemas-microsoft-com:datatypes">

<xsl:template match="tree">
<xsl:apply-templates select="entity"/>
</xsl:template>

<xsl:template match="entity">
<div onselectstart="return false;" ondragstart="return false;">
<xsl:attribute name="onclick">
<xsl:value-of select="onClick" />;
//clickOnEntity(this);
selectedEntity = '<xsl:value-of select="@id"/>';
dragControl.reset();
</xsl:attribute>
<xsl:attribute name="onmousedown">
<xsl:if test="count(ancestor::node()) > 2">
dragControl.beginDrag(<xsl:value-of select="@id"/>);
</xsl:if>
</xsl:attribute>
<xsl:attribute name="onmouseover">
dragControl.setTarget(<xsl:value-of select="@id"/>);
</xsl:attribute>
<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
<xsl:attribute name="image"><xsl:value-of select="imageBase"/></xsl:attribute>
<xsl:attribute name="imageOpen"><xsl:value-of select="imageOpen"/></xsl:attribute>
<xsl:attribute name="uniqueID"><xsl:value-of select="uniqueID"/></xsl:attribute>
<xsl:attribute name="parentID"><xsl:value-of select="parentID"/></xsl:attribute>
<xsl:attribute name="open">true</xsl:attribute>
<xsl:attribute name="STYLE">

padding-left: 20px;
cursor: hand;
</xsl:attribute>
<xsl:choose>
<xsl:when test="uniqueID > 0">
<table border="1" cellspacing="0" cellpadding="2" >
<tr onmouseover="this.bgColor='#FFFFCC';" onMouseOut="this.bgColor='#FFFFFF';">

<td valign="middle" width="50">
<img border="0">
<xsl:attribute name="id"><xsl:value-of select="@id"/>Image</xsl:attribute>
<xsl:attribute name="SRC">
<xsl:value-of select="imageBase"/>
</xsl:attribute>
</img>
</td>

<td onmouseover="this.bgColor='#FFFFCC';" onMouseOut="this.bgColor='#DCDCDC';" bgcolor = "DCDCDC" valign="middle" nowrap="true" width="350">
<input type="text" name="menuItem1" size="15" maxlength="50" id="{menuID}" value="{menuItem}" />
<input type="text" name="shortcut1" size="15" maxlength="50" id="{shortcutID}" value="{shortcut}" />
<input type="text" name="comment1" size="15" maxlength="50" id="{commentID}" value="{comments}" />
</td>
</tr></table>
</xsl:when>
<xsl:eek:therwise>
<table border="0" cellspacing="0" cellpadding="2" >
<tr onmouseover="this.bgColor='#FFFFCC';" onMouseOut="this.bgColor='#FFFFFF';">
<td valign="middle" width="50">
<img border="0">
<xsl:attribute name="id"><xsl:value-of select="@id"/>Image</xsl:attribute>
<xsl:attribute name="SRC">
<xsl:value-of select="imageBase"/>
</xsl:attribute>
</img>
</td>

<td valign="middle" nowrap="true" width="300"><b><xsl:value-of select="menuItem"/></b></td>
</tr></table>
</xsl:eek:therwise>
</xsl:choose>





<xsl:apply-templates select="contents/entity"/>
</div>
</xsl:template>

</xsl:stylesheet>

XML CODE
-----------------------------
<?xml version="1.0"?>
<tree>
<entity>
<menuItem>USED MENU ITEMS</menuItem>
<shortcut></shortcut>
<comments></comments>
<menuID></menuID>
<shortcutID></shortcutID>
<commentsID></commentsID>
<imageOpen>images/blank.gif</imageOpen>
<uniqueID>0</uniqueID>
<parentID>0</parentID>
<contents>

</contents>
</entity>
</tree>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top