[xsl] Declaring ns-prefixes for namespaces imported within a generated xml:schema

Subject: [xsl] Declaring ns-prefixes for namespaces imported within a generated xml:schema
From: "Robert Melskens" <tridero@xxxxxxxxxxx>
Date: Fri, 05 May 2006 15:35:30 +0200

Can anyone help me with the following simplified version of my problem?

I have a lot of XML-Schema's in which a lot of elements are created at global level. Each of them is created by a different creator and they all have their own target namespace. They all can refer to eachother and we don't know all schema's which will be used.
Besides that I also have XML files describing a specific form (lets call them form-instances).
Within each form-instance the elements are listed which are used within the related form.
In future a lot of different forms (and form-instances) will be created.

In the future we will also receive a lot of XML-instances, representing the content of the form.
To be able to validate these XML-instances we would like to generate an XML-Schema for each form-instance.

Using XSLT I create this, top level, XML-schema which imports all schema's containing one or more of the elements used within the form-instance.
I also create a top level element in which I place the needed elements which refer to the elements within the other XML-Schema's.
To be able to distinguish the namespace of each element I need to create a prefix for each namespace which I will use within the 'ref' attribute of the 'xs:element' element.
Since I don't know beforehand which namespace will be imported and don't know all possible namespaces I can't hard code the namespaces within my 'xsl:stylesheet' element.
As most of us will know declaring a prefix for each namespace needs to be done using the 'xmlns:xx' attribute.
However this attribute can't be created by using the 'xsl:attribute' element.

This is where de development of my stylesheet drives against a big wall.

Does anyone knows a way to overcome this problem? Thanks in advance.

Krijg direct antwoord op je vragen: MSN Messenger http://www1.imagine-msn.com/Messenger/Default2.aspx

Current Thread