Ask a Question related to Macromedia Dynamic HTML, Design and Development.
-
The Serpent webforumsuser@macromedia.com #1
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
-
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...... -
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... -
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... -
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: ... -
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... -
Code Ronin #2
Re: XML question: Interactivity
"The Serpent" [email]webforumsuser@macromedia.com[/email] wrote in message news:<bl2skq$pjl$1@forums.macromedia.com>...
Well, as you are asking about concepts, your transformation should us> 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>
<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].
Well, you have chosen a simple interactivity example. I am not sure if> 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?
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.
Good question. Personally, I believe in separating the content and the> 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>
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.
"Meant to be" is a subjective term. There is little to be gained by> Is the behaviour meant to be separate from presentation and structure as well?
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.
Ultimately, if you decide to embed scripts in your XSLT, you will have> on how to add interactivity to xml based web pages.
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
-
Zvika Gur-Esh #3
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



Reply With Quote

