org/1999/xlink">

<rect id="target1" width="150" height="100" fill="green"/>
<rect id="target2" y="150" width="150" height="100" fill="green"/>

<!-- an1: Change width by -100 in 4s on target1. The embedder script will change the target to 'target2' at 2s. -->
<!-- target1 should be 100px at 2s and remain this way. target2 should be 50px and remain this way. -->
<animate id="an1" xlink:href="#target1" attributeType="XML" attributeName="width" fill="freeze" by="-100" begin="0s" dur="4s"/>

</svg>

<script>
v