-1

i have been through the similar topics here but i could not find an answer. I ve got this xml code:

<Content>
    <StringValue formatted="false" name="Single.graphic.component.title">
         <Value>title of the single graphic</Value>
    </StringValue>
    <ImageDataItem name="single.graphic.component.image"> 
         <Value>iVBORw0KGgoAAAANSUhEUgAAAYUAAADeCAI</value>
    </ImageDataItem>
    <StringValue formatted="false" name="single.graphic.component.source">
         <Value>someValue2</Value>
    </StringValue>
</Content>

and my xsl says

<p>Grafik 1:<xsl:apply-templates select="//StringValue[@name='Single.graphic.component.title']/Value/node()"/></p>

<p><xsl:apply-templates select="//StringValue[@name='single.graphic.component.source']/Value/node()"/></p>

and it works for the two texts but not for the image(I know code is not there but i have tried it). If i write a value of the ImageDataItem the string is returned. Any clues?

kosta.dani
  • 447
  • 2
  • 11

1 Answers1

1

You have the wrong element name in the XPath for your image. You also need to use the Data URI Schema to present the base64 encoded image.

Try this instead...

<img>
  <xsl:attribute name="src">
    <xsl:text>data:image/png;base64,</xsl:text>
    <xsl:value-of select="//ImageDataItem[@name='single.graphic.component.source']/Value"/>
  </xsl:attribute>
</img>
Matthew Whited
  • 22,160
  • 4
  • 52
  • 69