Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

showing dynamic images with xml/xsl

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok, i've got some xml file like this:
<list>
<image>image1.gif</image>
.
.
.
</list>
i know, i have to use Javascript to display this images in a XSL file like
function ShowImage(pic, name) {
document.write ('<img src="images/' + pic + '" name="' + name + '" border="0">');
}
but this gets very annoying when it comes to "onMouseOver change the pic" pics and similar things (e.g. links, ...)
is there an easier way to solve this or do i have to stick to the JS way?
thanks for any advice,
Thomas
 
Leverager of our synergies
Posts: 10065
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Three is absolutely no need for JavaScript. You can output img tag with XSLT:
in your stylesheet:
<img src="{concat ('images/', list/image)}" onMouseOver="changeThePic()"/>
output:
<img onMouseOver="changeThePic()" src="images/image1.gif">
Put an XPath expression to access proper image instead of list/image. For example, if you have
<list>
<image>image1.gif</image>
<image>image2.gif</image>
</list>
and you want to access the second image, it will be "list/image[2]"
Also, you name doesn't comply with JavaRanch Official policy on registered names . Please, re-register following "FirstName LastName" pattern!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THX! i'm quite new to this so sorry for the feeble question
changed my name BTW, was in a hurry the last time.
nice board, skilled answers, i'm impressed.
cya
 
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your name "Thomas K" still does not comply with the JavaRanch naming policy. Note that your last name should be atleast two characters long.
Please spare a moment and re-register with a name that meets the requirements.
Thank you!
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
better?
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!
 
Get me the mayor's office! I need to tell him about this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic