Need help with displaying images from an xml file with XSLT

Discussion in 'XML' started by megabyte, Aug 22, 2006.

  1. megabyte

    megabyte

    Joined:
    Aug 22, 2006
    Messages:
    1
    Hi everyone,

    I am trying to implement a dropdown menu that gets populated by data from the xml file. The user could then make a choice from this menu, and according to the choice made, a different image is to be displayed. The "SRC" is also to be obtained from the xxml file.

    What I have done uptil now is to populate the menu from the xml file, but have difficulty in displaying the image according to the user's choice.

    Below is what I have done uptil now:

    <td>
    <select name="Menu" onChange="printer.src='{image}';">
    <option>Inkjet Models</option>

    <xsl:for-each select="Printers/Inkjet">
    <option value="{image}">
    <xsl:value-of select="model"/>
    </option>
    <xsl:for-each>
    </select>

    </td>
    </tr>

    <tr>

    <td border="1" valign="middle">

    <img name="printer" src="blank.gif"/>

    </td>


    Extraxt from my XML File

    <Printers>

    <Inkjet>
    <model>Stylus C86</model>
    <Colour>Separate Cartridges</Colour>
    <ColourPrice>None</ColourPrice>
    <colourYellow>C13T045440</colourYellow>
    <colourYellowPrice>Lm 6.00</colourYellowPrice>
    <colourCyan>C13T045240</colourCyan>
    <colourCyanPrice>Lm 6.00</colourCyanPrice>
    <colourmagenda>C13T045340</colourmagenda>
    <colourMagendaPrice>Lm 6.00</colourMagendaPrice>
    <Black>C13T04410</Black>
    <blackPrice>Lm 9.50</blackPrice>
    <image>C86.gif</image>
    </Inkjet>

    </Printers>

    I really appreciate any help. Kindly let me know if i was not clear in my explanation.

    Thanks in anticipation,

    Alan
     
    megabyte, Aug 22, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ken Varn
    Replies:
    2
    Views:
    569
    Ken Varn
    May 11, 2004
  2. =?Utf-8?B?dHBlcnJp?=

    Need help displaying images dynamically in a table

    =?Utf-8?B?dHBlcnJp?=, Jun 26, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    471
    =?Utf-8?B?dHBlcnJp?=
    Jun 27, 2005
  3. AnandSancheti

    Displaying Images in XML file.

    AnandSancheti, Oct 30, 2005, in forum: XML
    Replies:
    10
    Views:
    1,710
    Peter Flynn
    Nov 14, 2005
  4. jkflens
    Replies:
    2
    Views:
    1,500
    jkflens
    May 30, 2006
  5. Mad Scientist Jr
    Replies:
    1
    Views:
    536
    roy axenov
    Jul 20, 2007
Loading...

Share This Page