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 342773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:50:08+00:00 2026-05-12T10:50:08+00:00

I have an XSL style sheet for which I need to add some custom

  • 0

I have an XSL style sheet for which I need to add some custom string manipulation using an xsl:function. But I am having trouble trying to work out where to put the function in my document.

My XSL simplified looks like this,

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:my="myFunctions" xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:import href="Master.xslt"/>
  <xsl:template match="/">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <!-- starts actual layout -->
      <fo:page-sequence master-reference="first">
        <fo:flow flow-name="xsl-region-body">
          <!-- this defines a title level 1-->
          <fo:block xsl:use-attribute-sets="heading">
            HelloWorld
          </fo:block>
        </fo:flow>
      </fo:page-sequence>
    </fo:root>
  </xsl:template>
</xsl:stylesheet>

And I want to put in a simple function, say,

  <xsl:function name="my:helloWorld">
    <xsl:text>Hello World!</xsl:text>
  </xsl:function>

But I cannot work out where to put the function, when I put it under the node I get an error saying ‘xsl:function’ cannot be a child of the ‘xsl:stylesheet’ element., and if I put it under the node I get a similar error.

Where should I put the function? Idealy I would like to put my functions in an external file and import them into my xsl files.

  • 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-12T10:50:09+00:00Added an answer on May 12, 2026 at 10:50 am

    There is no xsl:function in XSL version 1.0. You have to create a named template

    <xsl:template name="helloWorld">
      <xsl:text>Hello World!</xsl:text>
    </xsl:template>
    
    (...)
    
    <xsl:template match="something">
      <xsl:call-template name="helloWorld"/>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an xsl:fo style sheet that refers to a URL which is an
I have searched around and found some tutorials for xsl:key and key() function, but
I have an xml resultset which has to be converted using XSL for display
I have a table schema which has some meta field data which I need
Using xslt/xpath, I need to be able to select the two elements which have
I have an xml file I wish to transform using an xsl-document, but I
I have some XML files of this form: <?xml version=1.0 encoding=utf-8?> <?xml-stylesheet type=text/xsl href=biomirror.xsl?>
I have a simple XSL file which looks like: <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl=http://www.w3.org/1999/XSL/Transform version=1.0>
Hi I have a XSL that i'm creating, which looks like this: <xsl:stylesheet version=1.0
I am using Saxon-B 9.1.0.8 and XSL 2.0. I have a XSL stylesheet, in

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.