0
votes

i have a problem with xslt. i want to create a call for google charts api in XSLT and it should look like this:

<img src="http://chart.apis.google.com/chart?chs=250x100&amp;chd=t:15.38,30.77,53.85&
amp;cht=p&amp;chl=FALSCH|DISS|RICHTIG&amp;chco=FF0000,A4A4A4,40FF00" border="0" 
alt="Beispiel"/>

i use the following code for this:

<xsl:variable name="source" select="concat(
'http://chart.apis.google.com/chart?chs=250x100&amp;chd=t:', $fehlerhaft , ','
,$disabled , ',' , $richtig , '&amp;cht=p&amp;chl=FALSCH|DISS|RICHTIG&
amp;chco=FF0000,A4A4A4,40FF00')" />

when i use on this point it returns

http://chart.apis.google.com/chart?chs=250x100&chd=t:15.38,30.77,53.85&cht=p&chl=FALSCH|DISS|RICHTIG&chco=FF0000,A4A4A4,40FF00

which is the right call, accept for the &-signs.

<img src="&lt;xsl:value-of select='$source'/&gt;" border="0" alt="Beispiel"/></p>

when i do the final call no picture is delivered. i think the problem ist the convert between & and &. is their a possibility to avoid this convert or is there another mistake?

1
edit: "&" and "&amp;" - user2724840

1 Answers

0
votes

An <xsl:value-of> instruction cannot be embedded in an attribute because the angle brackets of the instruction must not be escaped and an attribute is not allowed to have unescaped left angle brackets.

Use an attribute value template (brace brackets) with an embedded XPath expression to get the equivalent of <xsl:value-of> in a literal result element:

<img src="{$source}" border="0" alt="Beispiel"/>