The url variable inside the loop is being compiled to $this->url. I've only noticed it doing this when trying to use the variable name url.
<urlset>
{% for url in urls %}
<url>
<loc>{{ url.loc }}</loc>
<lastmod>{{ url.lastmod }}</lastmod>
<changefreq>{{ url.changefreq }}</changefreq>
<priority>{{ url.priority }}</priority>
</url>
{% endfor %}
</urlset>
Compiles to:
<urlset>
<?php foreach ($urls as $url) { ?>
<url>
<loc><?php echo $this->url->loc; ?></loc>
<lastmod><?php echo $this->url->lastmod; ?></lastmod>
<changefreq><?php echo $this->url->changefreq; ?></changefreq>
<priority><?php echo $this->url->priority; ?></priority>
</url>
<?php } ?>
</urlset>