Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Display Image from XML source

Display Image from XML source

Scheduled Pinned Locked Moved XML / XSL
htmlxml
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dotnetquery
    wrote on last edited by
    #1

    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.

    P 1 Reply Last reply
    0
    • D dotnetquery

      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.

      P Offline
      P Offline
      Phil Hobgen
      wrote on last edited by
      #2

      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(), and substring-after() or maybe just two consecutive calls to translate() would do it. You could just output the value of whats left over into the src 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

      D 1 Reply Last reply
      0
      • P Phil Hobgen

        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(), and substring-after() or maybe just two consecutive calls to translate() would do it. You could just output the value of whats left over into the src 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

        D Offline
        D Offline
        dotnetquery
        wrote on last edited by
        #3

        Thanks Phil, It worked. Thanks a lot for this.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups