Hello, I am working with an xsl file that I want to create a scroller, but the scroller is not completely self contained and it needs to call a javascript function called addScroller() in order to start working. Is there a way that I can do this? This is what I have written right now:
Code:
<?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="scroller">
<div id="spacer{generate-id()}" style="height: {@height}px; width: {@width}px;"></div>
<div id="clipper{generate-id()}" style="position: absolute; top: 0px; width: 0px; height: 0px; width: 0px;">
<div id="scroller{generate-id()}" style="position: absolute; top: 0px; width: 0px; height: 0px; width: 0px;"></div>
</div>
<script type="text/javascript">
<xsl:text>addScroller(getElement('spacer</xsl:text><xsl:value-of select="generate-id()"/><xsl:text>'), getElement('clipper</xsl:text><xsl:value-of select="generate-id()"/><xsl:text>'), getElement('scroller</xsl:text><xsl:value-of select="generate-id()"/><xsl:text>'), </xsl:text>
<xsl:choose>
<xsl:when test="not(element-available('speed')) or @speed = 'normal'">
<xsl:text>30</xsl:text>
</xsl:when>
<xsl:when test="@speed = 'fastest'">
<xsl:text>20</xsl:text>
</xsl:when>
<xsl:when test="@speed = 'fast'">
<xsl:text>25</xsl:text>
</xsl:when>
<xsl:when test="@speed = 'slow'">
<xsl:text>35</xsl:text>
</xsl:when>
<xsl:when test="@speed = 'slowest'">
<xsl:text>40</xsl:text>
</xsl:when>
</xsl:choose>
<xsl:apply-templates select="text" mode="scroll"/>
<xsl:text>);</xsl:text>
</script>
</xsl:template>
<xsl:template match="text" mode="scroll">
<xsl:text>,"</xsl:text><xsl:value-of select="."/><xsl:text>"</xsl:text>
</xsl:template>
</xsl:stylesheet>
Thanks a lot for your help.