XML with hyperlink

K

KL

I am totally new to XML and confused as heck. I have my xml file and want
one of my elements to be a website. Heck I even named the element website
(I know real original), but I can't make the website show as a valid
hyperlink in my html file. Any suggestions on what I am missing??

--

KL

"You don't love someone because they are beautiful, they are beautiful
because you love them." - Anon.
 
D

David Dorward

KL said:
I am totally new to XML and confused as heck. I have my xml file and want
one of my elements to be a website. Heck I even named the element
website (I know real original), but I can't make the website show as a
valid hyperlink in my html file. Any suggestions on what I am missing??

Your message is missing any indication as to how you are trying to transform
your XML into (X)HTML.
 
K

KL

David said:
Your message is missing any indication as to how you are trying to
transform your XML into (X)HTML.


I am linking to the XML file in my HTML file:

<html>
<head>
<title>RPG's</title>
</head>

<body>
<xml id="rpg" src="games.xml"></xml>

<table border="10" bordercolordark="#330066" bordercolorlight="#9900FF"
cellpadding="3">
<tr><td colspan="3" align="center" width="825" height="325"><img
id="picture" datasrc="#rpg" datafld="pic"></img></td></tr>
<tr><td colspan="3" align="center"><div id="name" datasrc="#rpg"
datafld="name"></div></td></tr>
<tr><td colspan="3" align="center"><span id="website" datasrc="#rpg"
datafld="website"></span></td></tr>
<tr><td align="center"><div id="character" datasrc="#rpg"
datafld="char"></div></td>
<td align="center"><div id="race" datasrc="#rpg" datafld="race"></div></td>
<td align="center"><div id="job" datasrc="#rpg"
datafld="job"></div></td></tr>
</table>
<br>
<br>
<table border="0">
<tr><td align="center" width="825"><button
onClick="rpg.recordset.moveFirst()">&lt;&lt; First Record</button>
<button onClick="rpg.recordset.movePrevious(); if (rpg.recordset.BOF)
rpg.recordset.moveFirst()">&nbsp;&nbsp;&lt; Previous
Record&nbsp;&nbsp;</button>
<button onClick="rpg.recordset.moveNext(); if (rpg.recordset.EOF)
rpg.recordset.moveLast()">&nbsp;&nbsp;Next Record&gt;&nbsp;&nbsp;</button>
<button onClick="rpg.recordset.moveLast()">&nbsp;&nbsp;Last
Record&gt;&gt;&nbsp;&nbsp;</button></td></tr>
</body>

</html>

Hope this makes sense.
--

KL

"You don't love someone because they are beautiful, they are beautiful
because you love them." - Anon.
 
A

Andy Dingley

I am linking to the XML file in my HTML file:
<xml id="rpg" src="games.xml"></xml>
<tr><td colspan="3" align="center" width="825" height="325"><img
id="picture" datasrc="#rpg" datafld="pic">

Why do you think this "datasrc" and "datafld" rubbish will help ?

Out of sheer curiosity, which obsolete M$oft textbook were you reading
when you saw this ? It never worked right, it never worked outside
M$oft, and it's a bad idea for all sorts of reasons. I know many
people have been misled down this dead-end before, but you're the
first I've seen in a few years.

Do it with XSLT, on the server. If you need a book (you will, XSLT is
complex), then I'd recommend Michael Kay's.

You can also do it client-side, but there are serious portability
issues with that.
 
K

KL

Andy said:
Why do you think this "datasrc" and "datafld" rubbish will help ?

Out of sheer curiosity, which obsolete M$oft textbook were you reading
when you saw this ? It never worked right, it never worked outside
M$oft, and it's a bad idea for all sorts of reasons. I know many
people have been misled down this dead-end before, but you're the
first I've seen in a few years.

Do it with XSLT, on the server. If you need a book (you will, XSLT is
complex), then I'd recommend Michael Kay's.

You can also do it client-side, but there are serious portability
issues with that.


Well, it is part of the college class that I am taking. Needless to say, it
is extremely aggravating that I can't get it to work. But the book on XML
said to use that datasrc and datafld. We are to make the XML database,
which I did fine, and them link it into an HTML file with buttons to go from
previous to last. I can't get it to do the hyperlink. If I could figure
out what I am doing wrong, or how to approach it, I think I could figure it
out.
--

KL

"You don't love someone because they are beautiful, they are beautiful
because you love them." - Anon.
 
A

Andy Dingley

Well, it is part of the college class that I am taking.

Change college ?
Needless to say, it
is extremely aggravating that I can't get it to work. But the book on XML
said to use that datasrc and datafld.

Yeah, well it's wrong.

W R O N G
 
A

Andy Dingley

I am linking to the XML file in my HTML file:

I appreciate my brief comments in the other post might not be so
helpful.

Google this newsgroup and you'll see past critiques of why DSO is a
poor way to use XML.
<http://groups.google.co.uk/groups?a...&[email protected]&lr=&hl=en>


Equally styling XML with CSS alone is a bad idea. It may work, but
it's very inflexible (Google c.i.w.a.h for why)


As an alternative, then for commercial web work you really need to use
a server-side XSLT transform into "plain" HTML. This works on all
client devices and it's the only really practical approach.


For intranets, or as "bells and whistles" teaching exercises, then you
can use IE-specific techniques like data islands. These use XSLT on
the client side.

Use some JavaScript like this, called from the onload event.:
document.all.divDest.innerHTML
= xmlSource.transformNode (xslStylesheet);

and HTML like this :

<html>

[...]

<body>

<div id="divDest" >This gets over-written by the XML transformed
content</div>

<xml id="xmlSource" src="games.xml"></xml>
<xml id="xslStylesheet" src="games_to_html_content.xsl"></xml>

</body>
</html>



You can still use the Next/Prev buttons, just pass an ID into the
stylesheet as a parameter. You'll find the MSXML SDK (downloadable
from M$oft) has a useful help file with code examples.
 

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,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top