Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: call javascript function in xsl

From: "Neil Smith [MVP Digital Media]" <neil@------.--->
To: NULL
Date: 2/7/2005 4:19:00 PM
Probably those script definitions need to be available to the
stylesheet when it's first parse, not when it's actually transforming
the XML. So in that case, stuff inside <xsl:if> and <xsl:choose> would
be unavailable to the stylesheet as extension functions.

In that case I'd suggest trying <xsl:include /> or <xsl:import /> to
bring in your function library at the start of the stylesheet (outside
xsl:template elements), and see if that helps : 

http://www.w3schools.com/xsl/el_include.asp
http://www.w3schools.com/xsl/el_import.asp

Cheers - Neil

On Mon, 7 Feb 2005 07:59:04 -0800, brian_harris
<brianharris@d...> wrote:

>I believe that I mean extension functions in XSL.  These functions are 
>executed to create specific data that creates data for HTML document being 
>created.  So they are executed in processing of XSL, not later when HTML 
>document being executed
>
>"Neil Smith [MVP Digital Media]" wrote:
>
>> Do you mean extension functions for XSL ? Or more likely did you mean
>> javascript embedded in HTML documents ? In case 2, I would just add at
>> the top of the stylesheet, in the HTML <head></head> tags, 
>> 
>> <script src="http://path/to/your/javascript-file.js"
>> language="javascript1.2" type="text/javascript"></script>
>> 
>> And then host your javascript-file.js in an appropriate place on your
>> server ;-)
>> 
>> Cheers - Neil
>> 
>> On Thu, 3 Feb 2005 09:29:01 -0800, brian_harris
>> <brian_harris@d...> wrote:
>> 
>> >I have an application that has several XSL style sheets.  In the style sheets 
>> >I am using the xsl:select tag to define javascript functions. At this time I 
>> >have duplicated many of the same javascript functions in seperate style 
>> >sheets, as per book examples.  But I now would like to have only 1 definition 
>> >of the functions and include it into each style sheet.  I would like to know 
>> >if there is a way to do this.  The main reason I want to do this is that in 
>> >one of these functions I have found a bug which will need to be fixed in each 
>> >XSL, so for future portability I would like to have these functions only 
>> >programmed once.
>> 
>> 



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent