![]()
|
|
|
Technologies Used:
Active Server Pages (ASP)
Server-side scripting in VBScript
eXtensible Markup Language (XML)
eXtensible Stylesheet Language (XSL)
Summary
Publishing content to the Web is a critical part of competition, but is still largely a complex task, which many organizations aren't yet equipped for or comfortable with
Employing automation scripts into your Web applications is an integral part of development efficiency
Web developers shouldn't be to be forced to become slaves to the apps they build
XML documents makes multi-platform publishing, data portability simple
Objectives
Make Web authoring easy for anyone in your workplace
Make multi-platform Web publishing possible
Make content syndication possible (portable to external sites)
Level of Difficulty
Intermediate
|
Making Web publishing
easier
It's the intent of software to make you work smarter,
not harder.
One of the biggest challenges that traditional companies face when just starting
to embrace the online revolution is the publishing aspect of getting their
content online (which for them, being newbies, can be a monstrosity of a
challenge). Traditional Web authoring mandated that a content author would have
to know the intricacies of HTML - which largely ruled out any staffers except
for progressive MIS programmers or a few daring advertising and creative people
- who also has to be savvy enough to know how to get their content online, like
via FTP.
As the Web continued to mature, more and more people began to pickup on how to
create HTML documents, but simultaneously Web access became available from
beyond the confines of the normative PC (mobile devices, Internet appliances,
etc.) making publishing quite complex in terms of the creation and management of
content. Controlling such a system is beyond the normal capacity of most
organizations today.
Since I currently manage a Web site for which local news information is the
prime attraction, it's important to me to be able to let our content producers
easily get their work up online - quickly - without forcing them to actually
write complex code (which they shouldn't have to do), and without me having to
do the work for them (which I shouldn't have to do). Its part of our
responsibility as developers to design and then deploy our applications, and
then move on to the next thing…and not become slaves to them, doing manual data
entry and updating.
In this lesson, we're going to build a very simple document management system,
which anyone in the office can use, thus freeing up your Web staff (in this
case, you) to work on other projects. We'll be using XML documents to hold our
core data - in this case, news articles - in combination with scripting within
Active Server Pages to present the content nicely. I use a system not unlike the
one we're about to create for running some aspects of our newsroom; you might
use it for company newsletters, product examples, or your personal listing of
your favorite episodes of "The Transformers". It's completely adaptable.
Letting your content get the most out of the Web
(without breaking your back in the process)
When I was mapping our site and its features in my head early on, I theorized
that to really be a superior competitor we would have to have our information
available in a variety of formats (HTML for our public site on the World Wide
Web, on mobile devices such as Palm Pilots, PocketPCs, and advanced mobile
phones through WAP, on alphanumeric pagers, through push channels using RSS, and
so on). I envisioned us having to have our data centralized and single-sourced,
so as not to force an author to write one story six separate times, in six
different formats.
It was also an interest of mine as a marketing tactic to develop a syndication
service for our content and have our news content portable, so that our
headlines could be implemented easily on other sites external to ours. I was
also interested in getting our articles well recognized by the major search
engines like Google and Excite, as well as by search directories such as Yahoo!
and Snap. Database-driven sites that generate querystring-based URLs (i.e.,
http://www.domain.com/filename.asp?id=8675309) aren't always crawled by search
engine and search directory spiders which results in pages not being indexed
with the Web's major search services, which is a negative factor in getting your
site recognized and marketed. Thus, I wanted to create a system that would
output our stories in individual files that search services would be able to
crawl and list better.
Enter XML.
|
Choose your weapons carefully…
OK, so it's not as dramatic as selecting pistols at dawn, but it's important to
know the capabilities (and limitations) of the technologies you're application
is based upon. I chose XML (eXtensible markup Language) as the fundamental data
technology because of its universality, and the fact that we can take a single
document, and have it ported to different platforms (our public Web site, our
mobile channels, our portable headlines) through the use of a number of written
in XSL stylesheets (eXtensible Stylesheet Language). The management of the
various formats for the document is simple.
I use Active Server Pages (ASP) as the presentation platform because it supports
a very simple script construct that lets us display the data in an XML document,
according to formatting defined in an XSL stylesheet:
|
The script instantiates the Microsoft
XML Document Object Model (MSXML DOM) twice, once for the XML document
containing our story data, and once for the XSL stylesheet we're going to apply
to it. The end result will be a file with the extension of .ASP, with the data
in the XML document presented as HTML.
ANALYSIS OF FUNCTIONALITY
What this system makes possible is multi-platform publishing. Remember here that
they key to make this app work is to make the core asset - the data - the key
ingredient, and not limiting ourselves to a single method of presenting that
data and likewise not imposing on ourselves the monstrous task of creating
separate pages for multiple platforms (in my example, our public Web site,
mobile device channel, push channel, external portable service). This makes
expansion easier.
If we choose, we can also make this data available to be ported to other
partners, who in my situation might be network news providers or local
affiliates. They can take the core data in the XML documents and write their own
formatting schemes using XSL's transformation language (XSLT) to have the XML
data work according to their own system's specifications, and then apply XSL's
formatting objects (XSLFO) to have it match their own color schemes, layout,
etc.
The way this system works is by:
Presenting the user with a simple Web form that they enter the appropriate data into - FORM.ASP
Passing the data through a processing script that will create an XML document on the fly and save it to the Web server, with customized tags that we'll define (and can easily modify) - CREATE-XML-DOC.ASP
Confirming the creation of the XML file and persisting filename information from the XML file to dynamically create an ASP file corresponding to the saved XML document - QUERYSTRING.ASP
Creating an Active Server
Page and saving it to the Web server that will be presented as formatted HTML
when viewed in the client's browser. Also check for the existence of errors,
to ensure that files with the same name are not written to the Web server's
disk, halting execution of the program, and reporting any found errors to the
user without catastrophically crashing the program. - NEW_STORY_TEMPLATE.ASP
Applying formatting to each that we'll define in a series of XSL stylesheets
to present our stories nicely in a variety of digital formats (Web, mobile
devices, push) - NEWS-ARTICLE.XSL
Download the tutorial
documentation and source code for this project
Have fun using this in your own projects!