XLink to other sites?

E

eagle0Nine

I'm fairly new at using XML XSL and XLink, and I was wondering how I
could use the three to create a menu link to another page (i.e. a menu
button "Contact Us" would link to a seperate contact page). I've tried
implementing XLink, but I seem to be failing. If I use it properly,
would the link show up on an XML file (the one I am viewing through
XSLT) as a hyperlink to another site (like any <a href>?). This seems
to be my major barrier. Any help is really appreciated.
 
M

Martin Honnen

eagle0Nine said:
I'm fairly new at using XML XSL and XLink, and I was wondering how I
could use the three to create a menu link to another page (i.e. a menu
button "Contact Us" would link to a seperate contact page). I've tried
implementing XLink, but I seem to be failing. If I use it properly,
would the link show up on an XML file (the one I am viewing through
XSLT) as a hyperlink to another site (like any <a href>?). This seems
to be my major barrier. Any help is really appreciated.

If you use XSLT then you can transform to HTML and use HTML links, that is
<a href="whatever.html">link text</a>
elements.
I am not sure what you want to use XLink for, Mozilla 1.4 I think
supports simple XLinks but other browsers don't do that.
 
C

Chris Barajas

OK, that doesn't help. So... how would I place a link like <a
href="whatever.html"> in an XML document, as opposed to the XSL?
 
M

Martin Honnen

Chris said:
OK, that doesn't help. So... how would I place a link like <a
href="whatever.html"> in an XML document, as opposed to the XSL?

Well, there is XHTML, and XML allows elements with different namespaces
so you could have
<a xmlns="http://www.w3.org/1999/xhtml"
href="http://javascript.faqts.com/">JavaScript.FAQTs</a>
as an XHTML link in an XML document, for instance

<?xml version="1.0" encoding="UTF-8"?>
<para>
This is text followed by an XHTML link
<a xmlns="http://www.w3.org/1999/xhtml"
href="http://javascript.faqts.com/">JavaScript.FAQTs</a>
</para>

Save that .xml and browser like Opera 7 or Netscape 7 which have
XML/XHTML support will recognize the XHTML namespace on the <a> element
and render it as a clickable link, just like in an HTML document.
But IE5/6/Win doesn't support that.

Or make any element an XLink:

<mylink xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:show="replace"
xlink:href="http://javascript.faqts.com/">JavaScript.FAQTs</mylink>

but only Mozilla based browsers like Netscape 7 then make that element a
clickable link, and you also need to apply some CSS to have the normal
underline look and the normal link color:

para {
display: block;
margin: 0.2em;
}
mylink {
text-decoration: underline;
color: blue;
}


XML example:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="test20031207.css"?>
<para>
This is text followed by a simple XLink
<mylink xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:show="replace"
xlink:href="http://javascript.faqts.com/">JavaScript.FAQTs</mylink>
</para>
 
C

Chris Barajas

Thanks. I tried the XLink a couple of times, and went "huh?" when it
didn't work.

Now, I'm going to go scream at Microblow.
 

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

Staff online

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,045
Latest member
DRCM

Latest Threads

Top