Display Image from XML source
-
Hi All, I am trying to display an image in an HTML page by inserting an IMG tag and specifying the SRC attribute in it. Now the source of the image is specified in the XML file but in the format url('http://www.somewebsite/image/myimage.jpg') now when I tried to insert the value of the element from the XML file it gdoes not displayes the image as it does not recognises the url keyword. I also tried it with style="behaviour:url('')" but it is not working. Is it possible to display the image.
-
Hi All, I am trying to display an image in an HTML page by inserting an IMG tag and specifying the SRC attribute in it. Now the source of the image is specified in the XML file but in the format url('http://www.somewebsite/image/myimage.jpg') now when I tried to insert the value of the element from the XML file it gdoes not displayes the image as it does not recognises the url keyword. I also tried it with style="behaviour:url('')" but it is not working. Is it possible to display the image.
Hi, If you are saying that you have some xml that is a bit like either :
<sometag>url('http://www.somewebsite/image/myimage.jpg')</sometag>
or :<sometag someattr="url('http://www.somewebsite/image/myimage.jpg')" />
If you are using XSLT then you could trim the outer parts of the string using a combination of string functions from:string-length()
,substring()
,substring-before()
, andsubstring-after()
or maybe just two consecutive calls totranslate()
would do it. You could just output the value of whats left over into thesrc
attribute This probably isn't very efficient (string functions), if you have to do it a lot, but if thats whats in the xml you might have to resort to something like this. Cheers Phil Hobgen barbari.co.uk Southampton, UK -
Hi, If you are saying that you have some xml that is a bit like either :
<sometag>url('http://www.somewebsite/image/myimage.jpg')</sometag>
or :<sometag someattr="url('http://www.somewebsite/image/myimage.jpg')" />
If you are using XSLT then you could trim the outer parts of the string using a combination of string functions from:string-length()
,substring()
,substring-before()
, andsubstring-after()
or maybe just two consecutive calls totranslate()
would do it. You could just output the value of whats left over into thesrc
attribute This probably isn't very efficient (string functions), if you have to do it a lot, but if thats whats in the xml you might have to resort to something like this. Cheers Phil Hobgen barbari.co.uk Southampton, UKThanks Phil, It worked. Thanks a lot for this.