xsl-list
[Top] [All Lists]

RE: an external javascript question

2003-02-07 09:37:23
Hi,

You are not resolving the JS file during transformation. This just puts the
script element in your output. The JS file has to be relative to the document or
hanging off the document root.

The easiest way to handle it, if served from a webserver, is to set the JS @src
to be root relative:

<script language="javascript" type="text/javascript" src="/js/web.js" />

Or if you need it offline you need to build the document relative path to the
JS:

<script language="javascript" type="text/javascript"
src="{$relative-context}web.js" />
where $relative-context is something like ../../js/web.js. The ../'s will be
determined by the position the transformed HTML relative to the JS file.

best,
-Rob

-----Original Message-----
From: owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
[mailto:owner-xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com]On Behalf Of TP
Sent: Friday, February 07, 2003 7:43 AM

I am trying to cut down the weight of my stylesheets. I had earlier asked a
question about import/include and thanks to a lot of very interesting
answers, I have trimmed down on the common templates. So at least 2 huge
formatting templates are out of the stylesheet and being imported.

Here is the other question, I am trying to move all the js out and try to
call the js as you would in html. I have tried everything that I could find
that other users have posted such as

<script language="javascript" type="text/javascript" src="web.js" />
<script language="javascript" type="text/javascript" href="web.js" />
<link rel="stylesheet" type="text/javascript" src="web.js"/>
<link rel="stylesheet" type="text/javascript" href="web.js"/>
<script language="JavaScript"  type="text/javascript"
src="web.js">&#160;</script>
<script language="JavaScript"  type="text/javascript"
href="web.js">&#160;</script>

The URIResover interface has been written and thats why my imported
stylesheets are found, so I am assuming that since the web.js file is in the
same folder, it should be found too, but for some reason, even after giving
the fixed absolute path, the xsl does not pick up the .js file.

As an alternative for now, I am importing the stylesheet that has the
javascript and calling the stylesheet by the template name. I am assuming
that this is not the procedure that most developers use on this list. As
soon as this is done, I want to do the same for the .css.

I would appreciate some tips.

On a side, this list helps a lot. Thank you.

TP.


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list