Hello, I seem to be having a problem displaying a image using a XSL transformation, and a source XML doc. The source xml for the image I have is:
Within the xsl stylesheet which I am using to transform info. in my xml file to a suitable display I have the following code to retrieve the location of the image:
The image doesn't display in the browser. I have embedded the xsl transformation in an <img> tag is it correct to do this? Could someone tell me the correct procedure to display this image using an xsl stylesheet transformation. Thanks.
That didn't work for me, error message: Cannot use <xsl:template> here. I think its because I have a for-each statement before I insert your code snippet. My xml tree structure is like this: <Holiday> <City> <Media......>code like before in orginal post. </City> </Holiday> I have a xsl:template match="/" at the start of my xsl:stylesheet. Can you help me further? Thanks.
Yes, the xsl:template element can only be used as a direct child of xsl:stylesheet.
I have a xsl:template match="/" at the start of my xsl:stylesheet.
It is a best practice to avoid writing your stylesheet as a one big, gigantic template element. If it's too much trouble at this point to divide your template into several smaller ones, you should try using my code snippet within the xsl:for-each (just the content of my xsl:template, not the whole thing). It would probably also help a lot if you'd post your XSL document (using the UBB code tags for decent formatting, please).
Hello , I embedded your code snippet into my xsl:for-each statement as follows:
The result displays the alt element ok in the browser, bit still the image is not displayed, I just see the standard X where the image should be. Also where would I put parameters for height and width into your code snippet for the image, just as an extra attributes I guess? Here is a snippet of my xml source file which is relevant to this particular problem:
Let me know if you can help please, looks like something so simple to me, but so annoying. Thanks for your help, Annemarie.