You could just write the Javascript in a seperate .js file and import it into 
the HTML using a <script> tag.  That would free you from the constraints of 
XSLT, and makes things cleaner anway.

--Dave
==================
David Walker
Library Web Services Manager
California State University
http://xerxes.calstate.edu
________________________________________
From: mikan.d.dspace listmail [mikan.dsp...@gmail.com]
Sent: Wednesday, February 04, 2009 6:46 AM
To: Andreas Geyrecker
Cc: dspace-t...@lists.sourceforge.net.
Subject: Re: [Dspace-tech] Custom Javascript in Structural.xsl

Thanks Adnreas,

This seems to fix the problem with '&' signs etc. But now Im getting
the following Javascript errors.
This is strange since the same piece of code works fine in dummy HTML
page. Something seems to go wrong when adding JS to XSL. What am I
missing here?

"missing ) after for-loop control
for (var i=0; i&lt;feed.value.items.length; i++) {\n"

"getFeed() function not found"

Mika



2009/2/4 Andreas Geyrecker <andreas.geyrec...@gmail.com>:
> Mika,
>
> try using a <![CDATA[ ... ]]> section for your javascript code.
>
> see also http://www.dpawson.co.uk/xsl/sect4/N9745.html
>
> Andi
>
>
> 2009/2/4 mikan.d.dspace listmail <mikan.dsp...@gmail.com>
>>
>> Im trying to add some custom Javscript code for our DSpace 1.5
>> instances. The problem is though, that when compiling the source I get
>> SAX errors because of '&' signs on Javascript code. Should I encode
>> the code somehow or how could I get around this?
>>
>> The line that causes the problem is the following:
>>
>> var addr = 'http://my.site.org/run?&_render=json&_callback=trythis';
>>
>> org.xml.sax.SAXParseException: The reference to entity "_render" must
>> end with the ';' delimiter.
>>
>> context:/file:/usr/local/jetty/jetty-6.1.12rc1/webapps/dikk/themes/TDS/./../dri2xhtml/structural.xsl
>> - 226:98
>>
>> Cocoon stacktrace [hide]
>> The reference to entity "_render" must end with the ';' delimiter.
>>
>> context:/file:/usr/local/jetty/jetty-6.1.12rc1/webapps/dikk/themes/TDS/./../dri2xhtml/structural.xsl
>> - 226:98
>>
>> Thanks for any tips,
>> Mika
>>
>>
>> ------------------------------------------------------------------------------
>> Create and Deploy Rich Internet Apps outside the browser with
>> Adobe(R)AIR(TM)
>> software. With Adobe AIR, Ajax developers can use existing skills and code
>> to
>> build responsive, highly engaging applications that combine the power of
>> local
>> resources and data with the reach of the web. Download the Adobe AIR SDK
>> and
>> Ajax docs to start building applications
>> today-http://p.sf.net/sfu/adobe-com
>> _______________________________________________
>> DSpace-tech mailing list
>> DSpace-tech@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/dspace-tech
>
>

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to