Can it be done using XSL?

R

richard green

I have a huge text file which contains a list of all possible services
that can be offered to the users. Let's say it looks like

<services>
<service>srv1</service>
<service>srv2</service>
</services>

But a user is not eligible for all the services. So if a user is
eligible only for service1 then his file will look like

<services>
<service>srv1</service>
</services>

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. Or can it be done using Java?

Any help or pointers are welcome.

Thanx in advance,
richard
 
A

Andy Dingley

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top