My input XML is as follows:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header>
<ns0:PartyInfo xmlns:ns0="http://www.google.com/">
<name xmlns="">John</name>
</ns0:PartyInfo>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns0:OperationRequest xmlns:ns0="http://www.yahoo.com">
<name xmlns="">Mary</name>
</ns0:OperationRequest>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
1) First problem: in my XSLT, I can only declare on value for my “ns0” namespace, so I can only access one of the nodes. How can I access them both (preferably in the same xslt file)?
2) Suppose I declare
xmlns:ns0="http://www.google.com"
Then the “John” string is output with extra characters:

I can use normalize-space to fix this, but it doesn’t seem right.
The namespace prefix you use in the XSLT code doesn’t have to be the same as the prefix used in the source document. It’s only the URI that needs to match. So in your XSLT, simply bind different prefixes to the two namespace URIs.