lenya-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jörn Nettingsmeier <netti...@apache.org>
Subject Re: How to call External Javascript from xhtml2xhtml.xsl?
Date Thu, 08 Nov 2007 12:35:05 GMT
Geert Verhaag wrote:
> Dear Lenya'rs,
> 
> I'm struggling with calling an external Javascript from within the
> xhtml2xhtml.xsl file.
> 
> The following is a new match I've added to it: 
> 
>   <xsl:template match="xhtml:div[@id = 'abstract']">
>     <p>
>      <script language="javascript" type="text/javascript"
> src="myscript.js"/>
>      <a href="javascript:myscript(myargument);">Abstract</a></p>
>   </xsl:template>
> 
> I'd like to actually run the script when clicking the Abstract link on
> the final html page.
> 
> At what location has the script to reside within the directory of my
> publication?

which lenya version are you using again?
iirc, for 1.2 you should move the script to 
$YOURPUB/resources/shared/javascript/myscript.js, and then you can 
include it in the xsl as
<script language="javascript" type="text/javascript" 
src="$root/javascript/myscript.js"/>
(i may be wrong, though. lenya 1.2 specialists might care to elaborate.)

a quick way to test it is to try a number of different URLs in the 
address bar of your browser before changing the XSLT - anything that 
works there will work in your XSLT.


-- 
Jörn Nettingsmeier

"One of my most productive days was throwing away 1000 lines of code."
   - Ken Thompson.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@lenya.apache.org
For additional commands, e-mail: user-help@lenya.apache.org


Mime
View raw message