For any attribute, use the base URI of the element.
<link href='mystuff.xml'/>
For any text content, use the base URI of the parent element.
<link>mystuff.xml</link>
For xml:base, use the base URI of the parent element.
<p xml:base="http://www.example.com"> A <a xml:base="/bingo/" href='stuff.xml'>link</a> </p>
In the first case, the base URI of 'p' is used but not needed as the value of the xml:base attribute is an absolute URL.
In the second case, the base URI of 'a' is used--which was inherited from 'p'. This gives the URL 'http://www.example.com/bingo/' for the 'a' element.