Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
05/18/2000
Times viewed :
6637
Page
1 of 4
Creating Dynamic Web pages with XML/ASP & XML
format
by Andrew Price
Before we get started, lets
have a quick show of hands.
Hands up all those who like
writing the same piece of code more than once.
Unless you're angling for some
compensation for getting repetitive strain injury or you're particularly
keen to show off a new and expensive deodorant then my guess is that your
arms, like mine, were kept firmly at your side.
That is why, when I wrote the
XSL and scripting demo,
I designed it so that I could easily add another article without having to redesign
a new ASP page for each demo, by using XML and XSL.
Basically, the first demo has
4 different stylesheets which are applied to the same XML. Rather than
hard-code the demo into one ASP page I decided to store the demo details
in its own XML file so that it would be a simple matter to add another
demo. The ASP page then reads the XML file and displays the details of
whichever demo has been requested.
Lets see an XML file of the simple
demo. (The comments in
red are for
explanatory purposes only and would not be included in a working XML document)
<VBexamples><--The
root of the XML document <example
id="2"><--The root of the particular demo <--The
title of the demo <--The authors name <--The
authors email <--The demo heading <--The XML file name <--The node of an XSL
example <xslFile>test1.xsl</xslFile>
<--The XSL file name <xslTextTitle>Example
1: the first xsl</xslTextTitle><--The heading
of the explanation <xslText>Doesn't
do much but its different to the other XSL's</xslText><--The
explanation <--Another XSL example <xslFile>test2.xsl</xslFile> <xslTextTitle>Example
2: the second xsl</xslTextTitle> <xslText>Bigger
and bolder</xslText> </example>
</VBexamples>