[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

How to change namespace prefixes in a import file hie

Subject: How to change namespace prefixes in a import file hierarchy? Or at least append som pattern?
From: "Ben Stover" <bxstover@xxxxxxxxxxx>
Date: Mon, 21 Dec 2009 13:35:59 +0100
 How to change namespace prefixes in a import file  hie
How to append a pattern to a namespace prefix? How to change a namespace prefix in a import file hierarchy?

Assume there is a directory (tree) of XSD schema files which start with ONE single "root" XSD 
schema file "root.xsd" and which in turn imports other, related XSD schema files.

Regarding the used, embedded namespaces and their prefix it looks like similar to:


<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
     <xsd:import namespace="http://www.somedomain.com/foo/bar/" 
     <xsd:import namespace="http://www.somedomain.com/blah/"
     <xsd:element name="..."  type="mypref1:myelement111Type"/>
     <xsd:element name="..."  type="other22:myelement222Type"/>

Keep in mind that this is a simplified sample. In real life I could have a system of dozends of imports,
hundreds of namespace prefixes and thousands of elements. 

Now I want to change all prefixes "mypref1" to "newpre7". I could this manually but due to the amount
of occurencies and the necessary changes this is not feasible. 
Furthermore I dont want to use an text editor replace function because this could be ambigious and 
not much simpler.

I would like to use a XLST script which would do the job for me (after changing just a
"from" and a "to" pattern inside this XSLT script.

Is this possible somehow?

All the prefix occurencies should be changed in the prefix definition and the usage places (e.g. <xsd:element>)
in all files of the import hierarchy.

How can I do this?

If a pure change is not possible: Can I at least append some postfix to a prefix (e.g. add

from: mypref1
to:   mypref1new

Thank you

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.