javascript embedded in xsl

webmasterbeta

New Member
Hello i am new to xml and xsl..
I am creating a row of divs with the source of mp3file as text, each has onclick function, i is incremented for each mp3file in the xml file, this all works fine.
But when i call the function, i has the same value for all the divs (= the number of mp3file in xml). Anybody got a clue?
Thanks in advance..


<body id = "framen">

<xsl:for-each select="playlist/mp3file">

<script type="text/javascript"><![CDATA[

var i =']]><xsl:number value=http://www.webdeveloper.com/forum/archive/index.php/"position()" format="1" /><![CDATA[';

var song=']]><xsl:value-of select="source"/><![CDATA[';

var track = document.createElement('div');

track.onclick = function(){setForm(i,true,this);}

track.style.border= '1px solid ' +color;

var theText1 = document.createTextNode(song);

track.appendChild(theText1);

document.getElementById('framen').appendChild(track);

:
:
]]></script>
 
Back
Top