SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Guru bronze trophy TomB's Avatar
    Join Date
    Oct 2005
    Location
    Milton Keynes, UK
    Posts
    996
    Mentioned
    9 Post(s)
    Tagged
    2 Thread(s)

    XML/XSL viable for web pages?

    Checking a very simple w3schools example here: http://www.w3schools.com/xml/simplexsl.xml it works in every browser i tried (Even IE6!)

    I'll admit my knowledge is basic, but I like the idea because it separates data from presentation.

    Is it a realistic option to have a web site using xml/xsl? If so, why aren't people using it.

    In theory, I can have my site layout in XSL, and use it to transform an XML document with the page content, title. Does this work in practice?

    If so, how are the documents styled? CSS? I thought XSL had its own style rules, but that example seems to use CSS.

    Is javascript supported?

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    You use XSL to transform your random XML into a HTML/XHTML document. The resulting document can be styled with CSS.

    Honestly I wouldn't bother doing this unless you have a large existing body of XML. Either run the transform beforehand and serve the cached/generated HTML files or just use HTML in the first place (or use XHTML if you need to use those documents as input to some other application and need XML well-formedness). At my job I have a bunch of XML data that has to be turned into HTML and I run the transform beforehand and post the genrated HTML files to the web server.

    And the reason XML/XSL isn't used often? It's a pain. If the data is meant to be edited frequently by multiple people I'd rather use a database, and if I'm the only one making updates I'd rather just edit HTML by hand. XML/XSL adds another layer of abstraction there that many just don't need.

  3. #3
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I did some minor work which involved scraping this website: http://wowarmory.com
    They use xslt(although they seem to sniff for opera and give it html).

    Just thought you might like to look at a large commercial site using the technology. I suspect part of their reason for using xml so heavily is because they anticipated the site would be heavily screen scraped(they actually encouraged it).

  4. #4
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Its funny, I came to this website to ask the exact same question and found your post!

    I was looking around and found the starcraft 2 website does the same thing. Apparently blizzard uses xml to make their websites. If it works in IE6, that is awesome.

    The way I had looked at it was this:

    Blizzard obviously is a gaming company with a demographic full of people who have up to date computers with up to date web browsers. This is why they can afford to use XML, because they don't need to worry as much about old browsers.

    But, if you say it works in IE6, I see no reason why this must be the case.


    From my perspective, the advantages for outweigh the disadvantages. HTML/CSS is really crappy compared to pure XML/XSL. HTML5 will be much better but won't necessarily be worth coding in for quite awhile after its become standardised because of all of the people who are behind the curve. This is why I think XML/XSL is so beautiful. Its well organised, gives you more freedom and is still compatible with old(er) browsers.

    Plus, I don't just program websites so I like the idea of having a technology that can be applied in systems programming, application programming AND web programming.

    I honestly think I am going to use XML/XSL for my up coming website.

    *excited*

  5. #5
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,649
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    We'll see how excited you are when you actually have to muddle through making Xsl come out with decent webpages.

    Basically, it boils down to the fact that if you are doing anything decent-sized, you will need a database and some server-side scripting to generate the Xml. And, once you have that in place, you'll likely realize that the server-side scripting is far more effective and vastly easier to work with vis-a-vis generating the site's html than using Xsl as your rendering engine.


Bookmarks

Posting Permissions

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