Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6591781
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:28:10+00:00 2026-05-25T17:28:10+00:00

How can I include/import javaScript file/libary in xslt file.

  • 0

How can I include/import javaScript file/libary in xslt file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T17:28:11+00:00Added an answer on May 25, 2026 at 5:28 pm

    If you need to use the javascript in the transformation (for example, it contains a set of extension functions that are called within the transformation), you need to put the javascript contents (at least that of one javascript file) in a separate XSLT stylesheet file, using the proper extension element (such as <msxml:script>) as the parent of the text-node that contains the javascript code.

    Here is a very simple example, using any Microsoft XSLT processor (MSXML3/4/6, XslCompiledTransform or XslTransform):

    file XSL-JS.xsl:

    <xsl:stylesheet version="1.0"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:msxsl="urn:schemas-microsoft-com:xslt"
          xmlns:user="http://mycompany.com/mynamespace">
    
     <msxsl:script language="JScript" implements-prefix="user">
       function xml(nodelist) {
          return "A B C";
       }
     </msxsl:script>
    </xsl:stylesheet>
    

    File XSL-Main.xsl that is importing the javascript:

    <xsl:stylesheet version="1.0"
          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
          xmlns:msxsl="urn:schemas-microsoft-com:xslt"
          xmlns:user="http://mycompany.com/mynamespace">
     <xsl:import href="XSL-JS.xsl"/>
    
     <xsl:template match="/">
       <xsl:value-of select="user:xml(.)"/>
     </xsl:template>
    
    </xsl:stylesheet>
    

    When the transformation, contained in the file XSL-Main.xsl is applied on any XML document (not used/ignored), the wanted, correct result is produced:

    A B C
    

    A completely different case is if you just want to generate with your XSLT application an HTML file that references a given Javascript file.

    Then you include this in your XSLT code and generate this literally as part of the output:

    <script type="text/javascript" src="SomePath/SomeFileName.js"></script> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know I can include Python code from a common file using import MyModuleName
How can include .asp file inside of html file and have it proccessed besides
The problem: I want to use PHP include to import file header_menu.html into all
I wonder how a can include an pre-compiled binary in an iPhone application. I
With Msbuild v3.5 I can include the /m switch to enable multiprocessor support .
I would like to know if I can include some Jquery inside another JQuery
Here is what I have- How I can include multiple keys and their values
I'm looking for a key/value pair object that I can include in a web
I have a loooooooooooong SELECT ending with a ORDER BY that can include the
Consider and client server scenario and you got two options: You can include Server's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.