Add image to pdf via xsl-fo using XML attribute value

I am making a PDF from an XMl document using XSL-FO. I need to import images using their names, which are inside the XML document.

XML example:

<newAlbums>
   <album cover="blaimage.jpg"/>
</newAlbums>

I need to do this with a similar statement:

<fo:external-graphic src="({})/>

What XPath do I need to insert in the src attribute to import the image? Thanks for the help that killed me.

+3
source share
1 answer

Mostly it will be <fo:external-graphic src="{concat('url(', /newAlbums/album/@cover, ')')}">. The exact XPath expression will depend on your XML. For example, you will most likely have more than one element of an album, so it will be required /newAlbums/album[1]/@coveror the like.

+9
source

All Articles