Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XSL/Javascript giving me hell

Status
Not open for further replies.

relisys

Programmer
Mar 6, 2003
65
GB
Can someone do me a kindness and have a look at a script i have embedded within my xsl stylesheet - basically all i want is a small vertical scroller (manual) which i can change the colour of the text, add images etc - simple?! ha!(getting the text from XML not a separate .txt or .html file:

<!-- SCROLLER STARTS HERE -->

<xsl:element name=&quot;script&quot;>
<xsl:attribute name=&quot;language&quot;>JavaScript1.2</xsl:attribute>

iens6=document.all||document.getElementById
ns4=document.layers

//specify speed of scroll (greater=faster)
var speed=5

//if (iens6){
//document.write('<div id=&quot;container&quot; style=&quot;position:relative;width:170;height:160;border:1px solid

//black;overflow:hidden&quot;/>')
//document.write('<div id=&quot;content&quot; style=&quot;position:relative;width:165;left:0;top:0&quot;/>')
//}
</xsl:element>

<div id=&quot;container&quot; style=&quot;position:relative;width:170;height:160;border:1px solid black;overflow:hidden&quot;>
<div id=&quot;content&quot; style=&quot;position:relative;width:165;left:0;top:0&quot;>
<ilayer name=&quot;nscontainer&quot; width=&quot;170&quot; height=&quot;160&quot; clip=&quot;0,0,170,160&quot;>
<layer name=&quot;nscontent&quot; width=&quot;165&quot; height=&quot;160&quot; visibility=&quot;hidden&quot;>
<!--INSERT HTML CONTENT HERE-->
<xsl:apply-templates select=&quot;//MedicalHistory&quot;/>
<!--END HTML CONTENT-->
</layer>
</ilayer>
</div>
</div>


<!--
<xsl:element name=&quot;script&quot;>
<xsl:attribute name=&quot;language&quot;>JavaScript1.2</xsl:attribute>
if (iens6)
document.write('</div></div>')
</xsl:element>
-->
<table width=&quot;175px&quot;><td><p align=&quot;right&quot;>
<a href=&quot;#&quot; onMouseover=&quot;moveup()&quot; onMouseout=&quot;clearTimeout(moveupvar)&quot;><img src=&quot;/medicare_files/scrollup.gif&quot;

border=&quot;0&quot;/></a> <a href=&quot;#&quot; onMouseover=&quot;movedown()&quot; onMouseout=&quot;clearTimeout(movedownvar)&quot;><img

src=&quot;/medicare_files/scrolldown.gif&quot; border=&quot;0&quot;/></a></p></td>
</table>

<xsl:element name=&quot;script&quot;>
<xsl:attribute name=&quot;language&quot;>JavaScript1.2</xsl:attribute>

if (iens6){
var crossobj=document.getElementById? document.getElementById(&quot;content&quot;) : document.all.content
var contentheight=crossobj.offsetHeight
}
else if (ns4){
var crossobj=document.nscontainer.document.nscontent
var contentheight=crossobj.clip.height
}

function movedown(){
if (iens6 && parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
crossobj.style.top=parseInt(crossobj.style.top)-speed
else if (ns4 && crossobj.top>=(contentheight*(-1)+100))
crossobj.top-=speed
movedownvar=setTimeout(&quot;movedown()&quot;,100)
}

function moveup(){
if (iens6 && parseInt(crossobj.style.top)<=0)
crossobj.style.top=parseInt(crossobj.style.top)+speed
else if (ns4&& crossobj.top<=0)
crossobj.top+=speed
moveupvar=setTimeout(&quot;moveup()&quot;,100)

}

function getcontent_height(){
if (iens6)
contentheight=crossobj.offsetHeight
else if (ns4)
document.nscontainer.document.nscontent.visibility=&quot;show&quot;
}
window.onload=getcontent_height

</xsl:element>
<!-- SCROLLER ENDS HERE -->

if i leave the &'s in i get:
org.xml.sax.SAXParseException: The entity name must immediately follow the '&' in the entity reference.

if i replace them with &quot;&amp;&quot; i get
org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup.

i must admit its taken all day to get a simple vertical scroller on the page. I mean all day like 7 hours - i'm beginning to lose it.

Any ideas / solutions would be so very gratefully received - maybe if it works i'll send some beers over! God this is getting me down - i've begun to realise that IT may not be for me. Please pass me my gun!!!!!

Cheers

Relisys
 
if i replace with &quot;& a m p ;&quot; that should read when i get the org.xml.sax.SAXParseException: The content of elements must consist of well-formed character data or markup error
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top