I gave up using JavaScript in the end and instead used Xlink. The following post to the svg-developers group shows the code I used in the end:
<http://tech.groups.yahoo.com/group/svg-developers/message/57249>
I initially chose not to go the Xlink way as it wasn't supported in my version of Firefox, but in version 2+ (and Opera) it's fine - as with IE 6&7.
I'm relatively new to hacking SVG and for a time it was like the bad old days of designing for a specific browser. Through trial and error I'm getting a hang of what works and what doesn't!