Transforming Locally Declared Namespaces into Globally Declared Namespaces

Subject: Transforming Locally Declared Namespaces into Globally Declared Namespaces
From: "Winchel \"Todd\" Vincent III" <winchel@xxxxxxxxxxxxxx>
Date: Thu, 1 Jul 2004 09:33:09 -0400
I would be grateful for any tips on the following issue:

I have two types of XML instances that I wish to transform into a third
type.  All of the instances validate against the same schema.  All instances
uses multiple namespaces.  I am calling these three types:

- Simple XML (Local)
- Complex XML (Local)
- Complex XML (Global)

Simple XML (Local) is XML with multiple namespaces declared *locally* on
elements *without* namespace prefixs.  For example:

<a xmlns="urn:a">
    <b xmlns="urn:b">
           <b>text</b>
           <b>text</b>
    </b>
    <c xmlns="urn:c">text</c>
<a>

Complex XML (Local) is XML with multiple namespaces declared *locally* on
elements *with* namespace prefixs.  For example:

<a:a xmlns:a="urn:a">
    <b:b xmlns:b="urn:b">
           <b:b>text</b:b>
           <b:b>text</b:b>
    </b:b>
    <c:c xmlns:c="urn:c">text</c>
<a>

Complex XML (Global) is XML with multiple namespaces declared *globally* on
the root element *with* namespace prefixes.

<a:a xmlns:a="urn:a" xmlns:b="urn:b" xmlns:c="urn:c">
    <b:b>
           <b:b>text</b:b>
             <b:b>text</b:b>
    </b:b>
    <c:c>text</c>
<a>

I prefer Complex XML (Global) because it is easy to read without the
namespaces cluttering the XML.  It is easy to tranform Complex XML (Global)
into Complex XML (Local) or Simple XML (Local).  However, I am looking to:

1. Transform Simple XML (Local) to Complex XML (Local) and/or to Complex XML
(Global), and

2. Transform Complex XML (Local) to Complex XML (Global).

Any thoughts on this would be appreciated.

Thanks,

Todd



Current Thread