Say you have a chunk of XML which has multiple namespace prefixes defined and some of them are actually the same namespace just with different prefixes. Using XSLT is there a not too complicated way to merge these prefixes so that you end up with just one prefix for each namespace? For example picking the shortest one?
Example
<soapenv:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:f="http://api.example.com/Service"
xmlns:foo="http://api.example.com/Service">
<soapenv:Body>
<foo:serviceResponse>
<f:profile id="1">Alice</f:profile>
<f:profile id="2">Bob</f:profile>
</foo:serviceResponse>
</soapenv:Body>
</soapenv:Envelope>
Should be turned into for example this:
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:f="http://api.example.com/Service">
<soap:Body>
<f:serviceResponse>
<f:profile id="1">Alice</f:profile>
<f:profile id="2">Bob</f:profile>
</f:serviceResponse>
</soap:Body>
</soap:Envelope>