• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

showing dynamic images with xml/xsl

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
  • Quote
  • Report post to moderator
better?
 
Ajith Kallambella
Sheriff
Posts: 5782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!