In my XML document, I am pulling the content of a <TextBlock> that contains images. The XML shows:
<img src="/templates_soft/images/facebook.png" alt="twitter" />
When I view the page, the image doesn’t show up because it is not at the same path as the original page.
I need to add the rest of the URL for the images to display. Something like http://www.mypage.com/ so that the image displays from http://www.mypage.com/templates_soft/images/facebook.png
Is there a way to do this?
Use:
where the xsl:variable named
$imageBaseis defined to contain the necessary prefix (in your case"http://www.mypage.com").Here is a complete XSLT solution:
when this transformation is applied on the following XML document:
the wanted, correct result is produced: