xsl-list
[Top] [All Lists]

Merging an imported xsd schema into the importing xsd schema with XSLT?

2004-12-13 07:21:59
Hello,

what I meant was the following scenario:

first.xsd:
<schema ... xmlns:dum="http://www.dummy.com/myns"; >
<import namespace="http://www.karl.com/"; schemaLocation="second.xsd" />
<dum:person  myattr1="xxx" dum:myattr2="yyy" />
...
</schema>

second.xsd:
<schema .... xmlns:bla="http://www.dummy.com/myns";
<bla:profession bla:exper="12" title="MSc"/>
...
</schema>

Now, when I merge second.xsd into first.xsd it looks
(after the first step !!) like:

combined.xsd:
<schema ... xmlns:dum="http://www.dummy.com/myns"; 
            xmlns:bla="http://www.dummy.com/myns";
            namespace="http://www.karl.com/";>
<bla:profession bla:exper="12" title="MSc"/>
...
<dum:person  myattr1="xxx" dum:myattr2="yyy" />
...
</schema>

But the namespace prefix "bla" covers the same namespace as the prefix
"dum". So I have to adjust all bla prefixes to dum in order to get the final
version. Furthermore I have to prepend all unprefixed, naked elements
and attributes with a new default namespace prefix "new".

The final schema should be (from my point of view):

<schema ... xmlns:dum="http://www.dummy.com/myns"; 
            xmlns:new="http://www.karl.com/";>
<dum:profession dum:exper="12" new:title="MSc" />
...
<dum:person  myattr1="xxx" dum:myattr2="yyy" />
...
</schema>

Again: How do I do this conversion with XSLT?

Matt
----
Michael Kay wrote:
As the subject said I want to textually merge an imported schema 
sub.xsd into the importing schema main.xsd.
Afterwards only one schema file should exist.

Is there a simple way in XSLT (2.0) to achieve this with XSLT?

If one schema document imports another, then they must have different target
namespaces. Are you trying to combine two target namespaces into one? If so,
this is not just a "textual merge", it's a rather delicate operation that
involves changing the names of the objects in the imported schema. Perhaps
you can give us a (short) example of what you expect to happen.

Michael Kay
http://www.saxonica.com/
------------
Orig:
As the subject said I want to textually merge an imported
schema sub.xsd into the importing schema main.xsd.
Afterwards only one schema file should exist.

Is there a simple way in XSLT (2.0) to achieve this with XSLT?

Otherwise I guess I have to include the imported schema file
and to replace the old namespace prefixes by these prefixes used in the=20
main.xsd.

Is the namespace replacement sufficient or do I have something more?

How do I replace the prefixes with XSLT?

Matt
-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--