Javascript and XML

Discussion in 'XML' started by MasterChief, Jan 16, 2006.

  1. MasterChief

    MasterChief Guest

    I have an XML file that stores the addresses of all of our locations.
    Then next I have a XSL file that displays the name of each of the
    locations in a drop-down box. What is the easiest way to make it so
    when the user choses Admin from the name list it goes back, gets the
    rest of the information and displays it into textboxes. So when a user
    clicks on Admin the text box for city is populated by the information
    in the xml file for the Admin City. Some of what I started with is
    below.

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="locations.xsl"?>

    <Locations>

    <store>
    <name>Admin</name>
    <address>Test</address>
    <city>Test</city>
    <state>Test</state>
    <zip>Test</zip>
    <country>United States</country>
    </store>

    </Locations>

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
    <html>
    <body>
    <h2>Locations</h2>
    Store Name:
    <select name="Locations">
    <xsl:for-each select="Locations/store">
    <option><xsl:value-of select="name"/></option>
    </xsl:for-each>
    </select>
    <input type="text" name="address" /><br>
    ..
    ..
    ..
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>
     
    MasterChief, Jan 16, 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.

Share This Page