xsl-list
[Top] [All Lists]

Re: [xsl] using XSLT to replace @ref in XML schema

2010-10-07 03:52:23

Inspired by an issue on another list (JAXB), I'd like to ask whether
someone here has ever seen or heard about an XSLT replacing all the
@ref by their respective target?

AFAIK, they are just shortcuts, and such a replacement shouldn't make
any difference.  Also, an XSLT would be a simple way of doing this -
or am I missing something?


I think I would first build a "grand schema" document by finding the transitive closure of all the includes/imports and expanding the document-level defaults such as targetNamespace, blockDefault, elementFormDefault etc into the individual components. Then define a key on the unique name of the component - concatenation of symbol space, target namespace, and local name. Then your transformation can find the @ref attributes (and similar, e.g. @type, @itemType), construct the composite key, and use the key() function to find the component in this "grand schema".

That still leaves you a few problems, however. For example, it simply isn't possible in XSD to move a referenced component inline if it is in a different target namespace. So perhaps you only want to move element and attribute declarations inline if they are in the same namespace - perhaps in the same schema document even - in which case it becomes much simpler because they all have the same document-level defaults.

Michael Kay
Saxonica

--~------------------------------------------------------------------
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>
--~--

<Prev in Thread] Current Thread [Next in Thread>