XSLT - How To Change the URL of a Namespace


April 2010.

Problem



You've got an XML document, like this one:





some content



However, the person who wrote it didn't know that the true identifier of the namespace of the document is not http://zewaren.net/old_location/, but rather http://zewaren.net/new_location/. So you need a style sheet to update the url.

Solution



This style sheet will re-output all the elements and attributes of the old namespace, and assign them a new namespace with the correct URL.




xmlns:oldmods="http://zewaren.net/old_location/"
xmlns:myns="http://zewaren.net/new_location/">