|
|
 |
XML scribblings as promised to a few people
date posted 29th September 2002 14:48
A few people contacted me off list wanting a bit more info on this subject,
so to save me sending the same mail several times I am posting it here. If
you don't consider XML and ASP to be your thang then this will be dull as
dishwater and I should move on to more interesting posts :)
If you are one of the people who asked for examples then I hope this is of
some use. I am always happy to discuss it and provide code examples where
time permits. Also, if anyone who has a good working knowledge of the
subject/technologies does things differently and can spare the time to tell
me where I am going wrong then any criticisms would be gratefully accepted.
-----------------
Ok, this site is a good example of what I was talking about, if not the
prettiest site in the world :)
http://www.carers.org/home/
The site uses one main XSL which contains the basic layout - the top and
right sections - the main white section is blank in this stylesheet
containing just
Each different section of the site has its own folder. Each folder contains
an XML parameter file that includes the section navigation details, a
section colour and a colour prefix for the image names (so all the image
tags look something like /img/{/ROOT/SECTION/PREFIX}-bg.gif)
When each page is created, two XSL/XML transforms are done (this is perhaps
an extreme example to give first), so the pages are built up as follows:-
1) The ASP page gets together everything it needs for its content area (the
white part of the page). This might be either building XML itself or
retrieving XML from the content management system.
2) This XML is then transformed alongside the XSL for this content type,
creating some HTML, but not the HTML for the entire page - it will just be a
table.
3) This HTML is then wrapped in XML tags i.e our HTML
4) This XML is then combined with all the other XML we need to for the page
5) The main site XSL/the pages XML are then transformed giving us the
finished article which we response.write to the page.
http://www.virtually-alaska.com
(Again don't shoot me for the design or the fact that the client insists on
uploading a million images)
This is actually one of about 50 www.virtually-xxx.com sites. They all use
the same code and same database (which makes for one massive host headers
entry in IIS). In this instance only a single transform is used, so if the
look of the site is to change all the pages must be changed (but there are
only a few pages).
However, if they want to change their branding you only change these few
pages and every site becomes different. If they just want to change one site
you just creating a few new XSLs in the new style and make the pages select
a different stylesheet.
http://siteslurper.fortune-cookie.com
Nothing to look at here I am afraid as it is a closed admin system, but what
it does do is something that would be pain to do in ordinary ASP. It allows
access to a simple admin system for people who want to be able to update
their sites but don't have an admin system or any HTML knowledge. You take
the page that they want to update - a product list say and create an XSL
version it. Then you add a user for them and set a few parameters in the
database to provide them with an admin tool (it is a reasonably generic
system). This is all very dull, but what it does which shows how useful XSL
is that it allows them to preview their page with the details they have
entered and if they are happy with it the system can upload it directly to
their site for them. This it can do easily as exactly the same code is used
to preview the page as create the disc version of it - the only difference
being that with one the result of the transform is response.write'd
(heh..written ?) to the screen, and with the other it is written to disc and
FTP'ed.
Sorry if it was a bit dry, but hopefully it gives you some idea why I don't
like writing plain HTML/ASP pages anymore.
Andy
PS - I include this one even though it breaks my heart
http://www.worldtravelevents.com/
I loved doing this with all its translations and stuff in XML and the client
never even bothered entering any text for it :)
|
 |
|