What I've just noticed is that when we have multiple transformations in the same parent thread (corresponding to seperate xsls being applied to the same input xml for rendering of a single html page), the xml declaration problem happens in the output of *all* the transformations. Hm. I wouldn't think that possible, either.
Transformed output:
-------------------
<img border="0" src="<?xml version=%221.0%22 encoding=%22UTF-8%22?>%0A/imageroot/images/2001/05/08/280ceos_168x155.gif" width="<?xml version="1.0" encoding="UTF-8"?>
168" height="<?xml version="1.0" encoding="UTF-8"?>
155"><br> <br>
Relevant part of xml source:
-----------------------------
<?xml version="1.0" encoding="us-ascii"?>
<story>
<body>
<body.head><img src="/images/2001/05/08/280ceos_168x155.gif" width="168" height="155" align=""/></body.head>
</body>
</story>
Xsl stylesheet: --------------- <?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
xmlns:lxslt="http://xml.apache.org/xslt">
<xsl:output method="html" omit-xml-declaration="yes"/><xsl:param name="image_root" select="''"/>
<xsl:template match="/">
<xsl:if test="story/body/body.head/img">
<xsl:choose>
<xsl:when test="story/body/body.head/img/@caption[text()]">
<table><xsl:attribute name="width"><xsl:value-of select="story/body/body.head/img/@width"/></xsl:attribute>
<tr>
<td>
<img border="0">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="(substring(story/body/body.head/img/@src, 1, 5) = 'http:')">
<xsl:value-of select="translate(story/body/body.head/img/@src, ' ', '')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($image_root, translate(story/body/body.head/img/@src, ' ', ''))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="story/body/body.head/img/@width"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="story/body/body.head/img/@height"/>
</xsl:attribute>
</img>
</td>
</tr>
<tr>
<td><div class="mainartphototxt"><xsl:value-of select="story/body/body.head/img/@caption"/></div></td>
</tr>
</table>
</xsl:when>
<xsl:otherwise>
<img border="0">
<xsl:attribute name="src">
<xsl:choose>
<xsl:when test="(substring(story/body/body.head/img/@src, 1, 5) = 'http:')">
<xsl:value-of select="translate(story/body/body.head/img/@src, ' ', '')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($image_root, translate(story/body/body.head/img/@src, ' ', ''))"/>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:attribute name="width">
<xsl:value-of select="story/body/body.head/img/@width"/>
</xsl:attribute>
<xsl:attribute name="height">
<xsl:value-of select="story/body/body.head/img/@height"/>
</xsl:attribute>
</img>
</xsl:otherwise>
</xsl:choose>
<br/> <br/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>
