Lorsque vous affichez des images dynamiquement, si vous voulez vous assurez qu'elles existent réellement, vous pouvez le faire assez aisément directement en XSL :
<!--
- Apply css with XSL
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:php="http://php.net/xsl" version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
  <xsl:template match="root">
    <html>
      <head></head>
      <body>
        <!-- On suppose que le noeud 'id' contient une partie du nom du fichier -->
        <xsl:variable name="imgSrc" select="boolean(document(string(concat('http://www.sillysmart.org/img/users/', id, '.jpg'))))" />
        <xsl:choose>
          <xsl:when test="$imgSrc">
            <img src="{concat('http://www.sillysmart.org/img/users/', id, '.jpg')}" alt="{id}" />
          </xsl:when>
          <xsl:otherwise>
            <img src="http://www.sillysmart.org/img/404.jpg" alt="Not found" />
          </xsl:otherwise>
        </xsl:choose>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>