Skip navigation
mjleavitt01236541
Currently Being Moderated

Spry XML and image map

Jun 28, 2012 7:03 AM

Tags: #dreamweaver #spry #xml

Hi all-

 

I'm new to using spry and xml, but not new to xhtml and layout, having said that. I'm trying to store file paths in my xml and parse that xml to repace <href> tags in an image map. For example (the actual cooridnates in the map are just made up for the example below, the actual map has 88 locations and very detailed coordinates, as it is a state map):

 

<head>

<script src="../SpryAssets/xpath.js" type="text/javascript"></script>

<script src="../SpryAssets/SpryData.js" type="text/javascript"></script>

var ds1 = new Spry.Data.XMLDataSet("../files/research/counties_census.xml", "ohio");

</head>

 

<body>

<div spry:region="ds1">

<img src="../images/CountyMap.gif" width="565" height="611" usemap="#Map">

        <map id="Map" name="Map">

          <area shape="rect" coords="103,156,155,202" href="../files/research/{Location}" />

          <area shape="rect" coords="216,156,286,210" href="../files/research/{OtherLocation}" />

        </map>

</div>

</body>

 

Am I just making a syntax error or is this just outside the scope of what I can use spry for? Any help is appreciated.

 

 

thanks in advance

 
Replies
  • Currently Being Moderated
    Jun 28, 2012 7:31 AM   in reply to mjleavitt01236541

    The XML should look like

     

    <?xml version="1.0" encoding="utf-8"?>
    <locations>
        <location>
            <name>MyLocation1</name>
            <coords>103,156,155,202</coords>
        </location>
        <location>
            <name>MyLocation2</name>
            <coords>216,156,286,210</coords>
        </location>
    </locations>
    

     

    The markup should look like

     

    <!doctype html>
    <html>
    <head>
      <meta charset="utf-8">
      <title>Untitled Document</title>
    </head>
    
    <body>
      <div spry:region="ds1">
        <img src="../images/CountyMap.gif" usemap="#Map">
        <map id="Map" name="Map">
          <area spry:repeat="ds1" shape="rect" coords="{coords}" href="../files/research/{name}">
        </map>
      </div>
    
      <script src="SpryAssets/xpath.js"></script>
      <script src="SpryAssets/SpryData.js"></script>
      <script>
        var ds1 = new Spry.Data.XMLDataSet("counties_census.xml", "locations/location");
      </script>
    </body>
    </html>

     

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 28, 2012 7:12 PM   in reply to mjleavitt01236541
    <label for="menu1">Click on a county, or select from the following:</label>
    <select spry:region="ds1" name="menu1">
      <option spry:repeat="ds1" spry:setrow="ds1" value="{county}">{county}</option>
    </select>
    
    <img src="../images/OhioCountyMap.gif" alt="" usemap="#Map">    
    <map spry:detailregion="ds1" name="Map">
      <area shape="poly" coords="{coords}" href="../files/research/{filepath}">
    </map>  
    

     

    Gramps

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points