xsl-list
[Top] [All Lists]

RE: Tramsform XML through mapping schemas using XSL

2002-11-27 02:53:28
It sounds to me as if you should treat your "configuration file" as a
high-level description of a stereotyped transformation, and use it to
generate a specific XSLT stylesheet for a particular transformation. You
can do this stylesheet generation in XSLT, of course.

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com 
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com] On Behalf Of 
Alistair Power
Sent: 27 November 2002 00:10
To: XSL-List(_at_)lists(_dot_)mulberrytech(_dot_)com
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