I only know the basics of CSS and started XML last night at 1:30am.
lets say I have a .xml file which contains a list of people; their names, ages and email adresses. How can I display the email address in a way so that it is a link?
Printable View
I only know the basics of CSS and started XML last night at 1:30am.
lets say I have a .xml file which contains a list of people; their names, ages and email adresses. How can I display the email address in a way so that it is a link?
maybe I should re-phrase;
can CSS make a link from some text?
i don't think that's possible. i might be wrong, but i dont think it is.
This question is hard to answer. XML is a meta language: you use it to define markup languages that follow a common pattern.
Your xml file would be written in an XML-based langugage that would look somewhat like this:
What does that say? It only says that there are two persons described in the file, and some info about them.Code:<people>
<person>
<firstname>Joe</firstname>
<lastname>Black</lastname>
<age>34</age>
<email>[email protected]</email>
</person>
<person>
<firstname>Jesus</firstname>
<lastname>Christ</lastname>
<age>2003</age>
<email>[email protected]</email>
</person>
</people>
The cool thing about this language is that it does just that. You can now do whatever you want with it: you can display it in a table, you can do statistical research etc. All provided that you have an application that does that.
And here's the thing: any application can use your data in whatever way it wishes. It can, for example, give the email address the behavior that when you click it, your mail client starts and you can immediatly send a mail.
In other words, your data is self-explanatory, and this behavior would be desireable for any app that displays the data. However that only works if the app is written for your data.
You probably want to have it displayed in a browser though.
Aside from the data XML languages such as your simple file, there are the functional XML languages: XHTML, MathML, SVG, ...
Most of them are standardized by the W3C and browser vendors try to implement their features.
XHTML has the <a> tag for links.
One option for you would be to use a XSLT sheet to transform your XML to XHTML and in the process wrap up the emails with <a>s. That's probably the best approach, because it's the only one that doesn't involve changing your data file.
But there's one alternative, provided that your browser understands it. I think IE does not, Mozilla does. The W3C makes all new standards modular so that they can be combined. You can makes use of this. First, you bring Mozilla to properly display your XML not as a tree, but as formatted data, by giving it a simple (or not so simple) CSS style sheet. Then you can use the XLink XML language to make some of your elements links.
The downsides are duplication of data and mixing of presentation with content, both are bad.