You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@lenya.apache.org by Geert Verhaag <g....@lrcb.nl> on 2007/11/12 12:30:01 UTC

Re: How to call External Javascript from xhtml2xhtml.xsl? - Solved!

Hoi,

Finally solved the problem! Jörn was right!

The page Serving Static Resources on the apache lenya site is however incorrect about that, isn't it?

It states that for MIME-type Javascript the prefix reads javascript/ while the directory is resources/javascript!

The directory however should be resources/shared/javascript!

Thanks!

Regards,
Gerard 


>>> nettings@apache.org 08/11/2007 13:35 >>>
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 


 

=====================

Dit bericht is uitsluitend bestemd voor de geadresseerde.
Het bericht kan vertrouwelijke informatie bevatten.
Als u dit bericht per abuis hebt ontvangen, wordt u
verzocht onmiddellijk de afzender te informeren. Ook
verzoeken wij u het bericht te vernietigen en de inhoud
niet onder derden te verspreiden of te gebruiken.

This message is intended exclusively for the addressee.
It may contain information that is confidential.
If you are not the intended recipient, we request that
you notify the sender immediately. In that case, we
also request that you destroy the message and that
you neither use the contents nor disclose them in any
manner to third parties.
=====================


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