• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xml and hyperlinks

 
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there,

I'm working with a project that utilizes xml. Ordinarily, for every element within the xml file, a filter is applied to replace double quotes, less than and greater then symbols ( ", <, > ) with their appropriate html equivalants ( ", <, > ).

However, I wanted to make a small change. For one of the elements, I wanted to make it possible for a user to provide HTML markup for hyperlinks. Such as: <a href="www.someplace.com">www.someplace.com</a>

I'm not sure if this is even allowed. So for the heck of it, I eliminated the filter for the one element, applied HTML markup for a hyperlink, and when I display the xml in the browser the HTML markup is indeed hidden but link is not a link. When I place my cursor over it, the cursor doesn't change to the pointing finger, nor does it recognize it as a hyperlink. I can click on that thing til the cows come home and nothing happens. Or for this forum I guess I should say "til the moose come home".

So, can HTML markup for a hyperlink in xml be accomplished? If so, how?

Alan
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand the question. Here's my sample XML document:

<?xml version="1.0" encoding="UTF-8">
<main>
<text>Hello, world</text>
<a href="www.someplace.com">www.someplace.com</a>
<text>Goodbye, world</text>
</main>

And when I ask Firefox or IE to display that, they display just that and nothing else. No special treatment for the <a> element. And why should there be any special treatment for it? It doesn't have any special meaning in XML.

But what you describe is something different. So there must be some special way that you display it in the browser. Can you explain about that?
 
Alan Shiers
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I guess I didn't give enough info.

My xml file has the following header:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="http://www.scholastictrackssandbox.ca/scholastic/stylesheets/schedule.xsl"?>
<!DOCTYPE schedule SYSTEM "http://www.scholastictrackssandbox.ca/scholastic/dtds/schedules.dtd">

I'm using a stylesheet that looks like this:



As you can see, I'm just setting up a table with five headers for: date, time,location, event, and comments. All of these simply contain strings. However, for the comments column, if its string contains the hyperlink: <a href="www.someplace.com">www.someplace.com</a> then it would be nice if it displayed as a hyperlink that you can click on instead of strickly text.

Alan
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Right, the fact that a transformation was happening is relevant information. Anyway, your code transforms <comments> elements like this:and since there's no template that specifically handles a <comments> element, the default processing for XSLT takes place. And the default processing (if I recall correctly) is to copy only the text nodes in the element. So it's not that the markup is "hidden", it's more that it is discarded. You could add a template that transforms a <comments> element by simply doing a full copy of it:
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic