0

I want to output an image using xslt. The src attribute will be comming from an xml node>

Example

<images>
     <![CDATA[/images/sample_image.png]]>
</images

in my xslt i outputted the image with the following code below but im getting a broken image.

<xsl:element name="img">    
   <xsl:attribute name="src"><xsl:value-of select="//images"></xsl:value-of></xsl:attribute>
</xsl:element>

but when i tried to output the image by hard coding the src, it worked.

 <xsl:element name="img">   
       <xsl:attribute name="src">/images/sample_image.png</xsl:attribute>
    </xsl:element>

is there any reason why the first code doesn't worked?

4

1 回答 1

3

尝试用 eg 去除空白<img src="{normalize-space(//images)}"/>,这可能会有所帮助。

于 2012-05-30T14:27:09.297 回答