Try putting the value into a variable and using that variable as the source to the src attribute see if that makes a difference. Also what version of umbraco you using?
I already tried using a variable too. Same results. I can see the value of the variable by itself, but not when I try to use it as an attribute value. The only way I've been able to get _anything_ to show up in the attribute is when I use hard-coded text as the attribute value.
I'm on Windows Server 2008. I saw the problem in Umbraco 4.5.0, and I upgraded to 4.5.1, but it's still happening.
I don't think the issue is the src attribute I think it's in your XPATH. Try outputting the required value separately and then put it back in the src attribute
Yes, I can output <xsl:value-of select="umbraco.library:Item($currentPage/@id, 'prodImage')" /> with no problem. The only time I have a problem is when I attempt to output the value within xsl:attribute tags.
Problem using XSLT to set HTML attribute
I've tried 2 different ways in an XSLT file to specify the src attribute of an img. Both of them just result in src="".
What's really strange to me is that the following statement by itself returns the correct value:
<xsl:value-of select="umbraco.library:Item($currentPage/@id, 'prodImage')" />
But when I move that same statement inside xsl:attribute, I get no value back for the attribute.
Option #1:
<img name="PRODUCT_IMAGE">
<xsl:attribute name="src">
<xsl:value-of select="umbraco.library:Item($currentPage/@id, 'prodImage')" />
</xsl:attribute>
</img>
Option #2:
<img name="PRODUCT_IMAGE" src="{umbraco.library:Item($currentPage/@id, 'prodImage')}" />
Any ideas?
Steve,
Try putting the value into a variable and using that variable as the source to the src attribute see if that makes a difference. Also what version of umbraco you using?
Regards
Ismail
Ismail,
I already tried using a variable too. Same results. I can see the value of the variable by itself, but not when I try to use it as an attribute value. The only way I've been able to get _anything_ to show up in the attribute is when I use hard-coded text as the attribute value.
I'm on Windows Server 2008. I saw the problem in Umbraco 4.5.0, and I upgraded to 4.5.1, but it's still happening.
Steve
I don't think the issue is the src attribute I think it's in your XPATH. Try outputting the required value separately and then put it back in the src attribute
Chris,
Yes, I can output <xsl:value-of select="umbraco.library:Item($currentPage/@id, 'prodImage')" /> with no problem. The only time I have a problem is when I attempt to output the value within xsl:attribute tags.
Sounds an odd one. What if you wrap the output in a string() function or a concat? e.g. concat(umbraco.library:Item($currentPage/@id, 'prodImage'),'')
is working on a reply...