xsl-list
[Top] [All Lists]

Re: Tramsform XML through mapping schemas using XSL

2002-11-27 10:41:47
Alastair,

Can you give us an example of your mapping configuration file and your
schema files? (Preferably short, though enough to highlight the challenges)

I was working on something similar to this a while back and want to check
whether what I was doing might help.

James Carlyle
www.takepart.com


----- Original Message -----
From: "Alistair Power" <Alistair(_dot_)Power(_at_)csw(_dot_)co(_dot_)uk>
To: <XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com>
Sent: Wednesday, November 27, 2002 12:09 AM
Subject: [xsl] Tramsform XML through mapping schemas using XSL


Hi,

Just trying to work out whether I can transform xml by mapping schemas
against each other using XSL, and thought I'd pick your brains for
ideas/suggestions/be told that it's impossible and I'm a fool for even
trying it :P

My problem is that I have a simple valid xml (generated from a
relational database which I don't have access to!), along with a
corresponding schema A which it adheres to, and I want to transform it
into a different slightly more nested xml document, which validates
against schema B. Both schemas are different enough so that certain
element values in the source schema A might become attribute values in
schema B, and vica-versa.

I know the exact mappings between the data in the source and target
schema. What I ideally want to achieve is to store the mappings in a
configuration xml file, and write a series of (generic?) XSL templates
that get called based on iteration through the mapping file plus source
xml file, and after a bit of magic output my target xml file, conformant
to schema B.

Now I could just write a straight transformation that took the source
and transformed it, but I will be using different schemas in the future
with different data and mappings, so wanted to try and approach this in
a more generic fashion, with possible deference to the two schemas.

So my questions are:
1. Do you think this is feasible through the use of just XSL?
2. Is it feasible to match nodes against data from a config file, and
pass the resultant chosen node into a config defined transformation (say
calling a specific template)?

Apologies if the scenario description is a bit vague, but this is
currently an idea in my head, and I am not sure whether this is
something that would be better solved programatically with the support
of XSL or through XSL alone.

Thoughts/comments/ideas much appreciated...
Thanks,
Alistair

Alistair Power
alistair(_dot_)power(_at_)csw(_dot_)co(_dot_)uk



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list