I’m in Symphony CMS trying to return an article image like so.
<img src="{$workspace}/uploads/{/data/news-articles/entry/image-thumbnail}"/>
The output looks like this
<img src="/workspace/uploads/%0A%09%09%09%09penuts_thumb.png%0A%09%09%09%09%0A%09%09%09">
If I just try to return the node value
<xsl:value-of select="image-thumbnail" />
Output looks correct
penuts_thumb.png
Any thoughts on why I’m getting all the excess characters?
No, it only “looks correct”, because the browser ignores white-space characters.
What happens is that the string
"penuts_thumb.png"is surrounded by whitespace. When this whitespace is serialized as part of thesrcattribute value, it is encoded (normalized) — this is why you see%0A(code for newline) anf%09(code for tab).This transformation helps to see exactly what is generated in each case:
when applied on this XML document:
produces this output:
As we can see (thanks to the quotes) in the second case the string
"penuts_thumb.png"is also surrounded by a lot of whitespace characters.Solution:
Use the
normalize-space()function in this way: