/    Sign up×
Community /Pin to ProfileBookmark

displaying data from xml (xsl) to HTML(xhtml)

I am not sure if this is the right area to ask this question…

i have a xml document that links to a xsl file creating the visual for it. I would like to know how to get that to report in my xhtml file.

Because of the way my html file is situated, i have a <td width=”590″> specific size that the xml data should fit right in based on the xsl. I was looking to use a <span></span> to somehow pull that data in so that this F-in website will work with both IE6+ and STUPID Netscape Navigator :rolleyes: .

My original attempt worked great in IE but not Netscape Navigator because my function used the ActiveXObject:
function focusItem() {
var xmlDoc = new ActiveXObject(“microsoft.xmldom”);
xmlDoc.async=false;
xmlDoc.load(“ticker_trial3.xml”);
ticker=xmlDoc.documentElement;
newHTML=””;
document.all.focusticker.innerHTML=focusEntry();
}

Please help me out on how to call this xml or xsl into my html document so that it is functional in BOTH STUPID browsers.

if you need my code let me know — but i think this is a simple question where i have xml calling xsl which displays all the contents in the same size table as the HTML space is looking for. Do i need a function to call or load xml without using ActiveX… and have the <span> link with that?

Anthony

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@ray326Feb 05.2004 — I sounds like you may be doing something very similar to the Netscape Dev Edge article, Inner Browsing. One of their cases is xml driven.

http://devedge.netscape.com
Copy linkTweet thisAlerts:
@AcemanauthorFeb 05.2004 — all i really need is a way to call a list of xml fields in xHTML and have it populate a table and have it accessible to most browsers.

i just can't seem to get it to work anyway without netscape messing up the webpage saying it cant see ALL of the info on it.

Anthony
Copy linkTweet thisAlerts:
@FangFeb 05.2004 — &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt;
&lt;head&gt;
&lt;title&gt;XML into XHTML Mozilla and IE&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /&gt;
&lt;script type="text/javascript"&gt;
//&lt;![CDATA[
&lt;!--
function LoadXML() {
// <a href="http://www.scottandrew.com/weblog/2002_04#a000257">http://www.scottandrew.com/weblog/2002_04#a000257</a>
// <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmobjpmexmlhttprequest.asp">http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk30/htm/xmobjpmexmlhttprequest.asp</a>
try {
// for Mozilla
req = new XMLHttpRequest();
req.overrideMimeType("text/xml");
} catch (e) {
// for IE5+
req = new ActiveXObject("Msxml2.XMLHTTP");
}
req.open("GET", "ticker_trial3.xml",false);
req.send(null);
document.getElementById("List").innerHTML = req.responseText;
}
//--&gt;
//]]&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload="LoadXML()"&gt;
&lt;p id="List"&gt;&lt;/p&gt;
&lt;/body&gt;

Change the file /path, you should be able to do the rest ?
Copy linkTweet thisAlerts:
@AcemanauthorFeb 05.2004 — That did seem to help on getting the data to report.

NOW my question is --- since it only appears as a paragraph full of text. How do i get it into the table.

The xml has a code at the begining like this:

<?xml version="1.0" encoding="iso-8859-1"?>

<?xml-stylesheet type="text/xsl" href="scrollertrial4.xsl"?>

So it refers to an xsl stylesheet which sets up the table. Am I wrong in assuming that when your code opened up the xml in xhtml that it doesn't read the xsl to put it into the proper setup?

And i know that when i double click on the xml document, it opens in a browser nicely organized in a table i wanted. So then why does loading it with your code exclude the stylesheet? Or how should i set it up individually?

Anthony
Copy linkTweet thisAlerts:
@FangFeb 05.2004 — I think the simplest way to do it is by loading the XML into an ifame.

A document in a document, rather than data into a document.
×

Success!

Help @Aceman spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...