Reputation: 693
I been wondering for some while now. Could you possibly create a web site build with use of XML and XSLT? For a fact I know you can style XML pages with XSLT which is similar to CSS. I seen some sites with .xml extension in the URL, but to my view that seems more like Mod_Rewrite instead of actual .XML file. So could somebody confirm this. Is it possible? Or is it not possible to make XML based web pages just liked you would with HTML?
Upvotes: 1
Views: 330
Reputation: 2167
Note that you can style .xml with css as well. However, since there is no default
styling, you have to be explicit about the css display attribute for each element tag.
You can also use css generated content to add text, and for example, display
<sometag>text</sometag>
as sometag: text
However, getting linking semantics to work cross browser is a bit of a problem:
link {text-decoration: underline; color: blue; link: attr(href)}
for example, will work in some but not all browsers, to make <link href=URL>
work like a clickable link. ( Perhaps a javascript solution works more portably. )
But doing xslt conversion to html in the browser with an <?xml-stylesheet >
directive
seems to work in all modern browsers without problem, and can do a lot more than css alone.
Some examples here.
Upvotes: 1
Reputation: 163468
Yes, of course you can do this. Many people do.
To expand a little, there are three stages at which you can apply the XSLT: at publishing time (in which case you publish HTML on your site, and your users never know it was once XML); at page delivery time on the server, and at page delivery time in the client browser. Relatively few people use client-side XSLT, because it's only recently that it's been available on every browser (and even now, it's often not available on mobile browsers).
Upvotes: 3
Reputation: 308958
Sure, use XML data and Velocity templates to generate the page.
I prefer Velocity because the template looks like the end product; not so with XSL-T.
Upvotes: 1