Results 1 to 4 of 4

Thread: XML and CSS - making links

  1. #1

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090

    XML and CSS - making links

    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?
    Have I helped you? Please Rate my posts.

  2. #2

    Thread Starter
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    maybe I should re-phrase;
    can CSS make a link from some text?
    Have I helped you? Please Rate my posts.

  3. #3
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629
    i don't think that's possible. i might be wrong, but i dont think it is.
    Like Archer? Check out some Sterling Archer quotes.

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    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:
    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>
    What does that say? It only says that there are two persons described in the file, and some info about them.
    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.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width