XML question: Interactivity

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default XML question: Interactivity

    Hi guys

    Not quite sure if this is the correct forum to post this, so mods can feel free to move this to another suitable forum if they want to.

    Ok, now on to my question: I am new to XML and I have some problems with some of the concepts involved. Just say for the sake of discussion, I have a simple xml file like this with an appropriate dtd like this [I am not showing all the code]

    <employee>
    <firstname>Harry</firstname>
    <lastname>Potter</lastname>
    </employee>

    Then, I can use XSLT to transform the above into something like:

    <table>

    <tr>
    <td>First Name</td>
    <td>Harry</td>
    </tr>

    <tr>
    <td>Last Name</td>
    <td>Potter</td>
    </tr>

    </table>

    Ok, thats all fine. Now, what if I want to add interactivity to the page: say when the user mouseover the first name, the cell should change color --- how do I do something like that? Do I build the behaviour functions in the XSLT as well so that the code is something like this:

    ..
    ..
    ..
    <tr>
    <td onmouseover="changeColor();">First Name</td>
    ..
    ..

    Thats my conceptual problem at the moment? Is the behaviour meant to be separate from presentation and structure as well? or do I mix the presentation and behaviour but keep it separate from the structure? I will really appreciate your help If anyone can point me to some resources on how to add interactivity to xml based web pages.

    Thank you




    The Serpent webforumsuser@macromedia.com Guest

  2. Similar Questions and Discussions

    1. director 3d interactivity
      I have a project i am doing so when u click it changes some things on the main 3d images... for example... a body, the size, the hair, the eyes......
    2. database interactivity
      Is there a tool that will allow my publisher website to interact with a database - preferably access and preferably a tool that doesn't require any...
    3. Adding SVG Interactivity to artwork
      As a continuation from my "creating a website on ai" below, I am trying to create rollovers, and as mentioned in the forum I am in the "help" menu...
    4. Buttons and Interactivity
      I am attempting to build a navigation system similar in concept and theory to http://www.firstbornmultimedia.com Here's my navigation dilemna: ...
    5. Interactivity with Director
      Hi all, I'm currently entering my final year at university (England) and am now selecting my final year project. I'm looking at creating a...
  3. #2

    Default Re: XML question: Interactivity

    "The Serpent" [email]webforumsuser@macromedia.com[/email] wrote in message news:<bl2skq$pjl$1@forums.macromedia.com>...
    > Then, I can use XSLT to transform the above into something like:
    >
    > <table>
    >
    > <tr>
    > <td>First Name</td>
    > <td>Harry</td>
    > </tr>
    >
    > <tr>
    > <td>Last Name</td>
    > <td>Potter</td>
    > </tr>
    >
    > </table>
    Well, as you are asking about concepts, your transformation should us
    <th> for the First Name and Last Name cells. This conveys that the
    information is a "header" and not a data cell. For a discussion on why
    you want to do that, see
    [url]http://www.evolt.org/article/Building_accessible_tables/4090/42090/index.html[/url].
    > Ok, thats all fine. Now, what if I want to add interactivity to the page: say
    > when the user mouseover the first name, the cell should change color --- how
    > do I do something like that?
    Well, you have chosen a simple interactivity example. I am not sure if
    that was intended. But, another option is to apply CSS styles to the
    cell to achieve the effect you want -- all without JavaScript. Google
    on "css mouseover" to get an idea of how to do what you want.
    > Do I build the behaviour functions in the XSLT as well so that the code is something like this:
    > <tr>
    > <td onmouseover="changeColor();">First Name</td>
    Good question. Personally, I believe in separating the content and the
    presentation as much as possible. Normally, that means applying CSS
    styles, but if you find that the interactivity is more complex, you
    need to use script. Rather than "embedding code" into the HTML, you
    can separate it, like so:

    function init ( ) {
    // ... write code to get the <table>
    // ... write code to loop through the <table>
    // ... apply to each cell that needs the mouseover effect
    cell.onmouseover = handleMouseOverDoWhatever;
    // ... other initialization code
    }

    function handleMouseOverDoWhatever ( event ) {
    // ... event handling code goes here
    }

    As for the XSLT, you can either include the <link> reference in the
    HTML generation -- if you choose CSS to solve your problem -- or
    include the <script src="..."> reference.

    In either case, leave the CSS and script in external files and your
    XSLT will be simpler and shorter.
    > Is the behaviour meant to be separate from presentation and structure as well?
    "Meant to be" is a subjective term. There is little to be gained by
    keeping it together and more to be gained (organizationally) by
    separating it. Also, by separating it, you increase the chance of
    reuse. Further, if you decide to make a change to the common portion,
    if it is embedded into multiple XSLT files, you will have to find and
    change all such instances.
    > on how to add interactivity to xml based web pages.
    Ultimately, if you decide to embed scripts in your XSLT, you will have
    to use the <![CDATA[ ]]> wrapper around your code, so that < and >
    will not be misinterpreted, such as in a JavaScript statement:

    if ( x >= 1 ) {

    Hope that helps.
    Code Ronin Guest

  4. #3

    Default Re: XML question: Interactivity

    Yes, add the function caller within the XSLT, as any other HTML elements.

    If you would like read more about XML, I've posted few small tutorials in:
    [url]news://ls.magicbeat.com/magicbeat_xml[/url]

    --
    Zvika Gur-Esh
    Programmer
    <?.........?>
    --


    Zvika Gur-Esh Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139