On 6 Apr 2004 13:55:37 -0700,
gr******@hotmail.com (richard green)
wrote:
The flags which govern whether the user is eligible for a service are
stored in a database. Is it possible to write an XSL stylesheet which
will inquire any database (including relational and flat file) to
output the final xml shown above.
It's possible to do almost anything if you try hard enough....
XSL transforms XML into something else, usually XML. Every piece of
the source data is contained in the source document(s) and the
stylesheet. It can't do something like this on its own.
There are also XSL extensions, either proprietary or some emerging
open standards. These allow you to hook in snippets of JavaScript etc.
Very useful if you need some regexes to do the sort of string handling
that XSL and XPath are usually poor at. As it's just JavaScript (or
JScript), then you can also start connecting out to databases and from
their the world is your lobster.
I have done this in the past, when I had a problem that was basically
an XSL problem, but a lookup to expand a magic code into the current
DB lookup values. Eccentric, but it did the job.
But that isn't how I'd do this. This is a classic example of a simple
DB query / addition to a DOM. No XSL required, although you'll often
use some in a later step. Find an appropriate DOM for your language
choice and read the examples - there should be a suitable one pretty
early on.
Or can it be done using Java?
I did it about three times today, using ASP & JavaScript. A few months
back and I'd have been doing it in Java. Give it a few weeks and I
think I'm using PHP. Every viable language these days has ready
access to an XML DOM (languages that don't are on shaky ground)
--
Smert' spamionam