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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T07:21:39+00:00 2026-05-23T07:21:39+00:00

My attempt: <xsl:template name=GetDisplay> <xsl:param name=input/> <xsl:text>|</xsl:text> <xsl:call-template name=GetDisplay_1> <xsl:with-param name=input select=$input/> </xsl:call-template> <xsl:text>

  • 0

My attempt:

<xsl:template name="GetDisplay">
        <xsl:param name="input"/>
        <xsl:text>|</xsl:text>
        <xsl:call-template name="GetDisplay_1">
            <xsl:with-param name="input" select="$input"/>
        </xsl:call-template>
        <xsl:text> |</xsl:text>
    </xsl:template>

<xsl:template name="GetDisplay_1">
    <xsl:param name="input"/>
    <xsl:text> </xsl:text>
    <xsl:call-template name="GetUpper">
        <xsl:with-param name="input" select="substring($input,1,1)"/>
    </xsl:call-template>
    <xsl:variable name="head" select="substring-before($input,'_')"/>
    <xsl:choose>
        <xsl:when test="$head=''">
            <xsl:value-of select="substring($input,2)"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="substring($head,2)"/>
            <xsl:call-template name="GetDisplay_1">
                <xsl:with-param name="input" select="substring-after($input,'_')"/>
            </xsl:call-template>
        </xsl:otherwise>
    </xsl:choose>
</xsl:template>

<xsl:template name="GetUpper">
    <xsl:param name="input"/>
    <xsl:value-of select="translate($input,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
</xsl:template>

Instead of having the need of 2 functions (GetDisplay and GetDisplay_1) i want to have only 1 function to accomplish the same result (we may leave the GetUpper intact of course).

Is it even possible?

PS: Strictly XSLT 1.0 thanks. (and no EXSLT / etc thanks)

  • 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-23T07:21:39+00:00Added an answer on May 23, 2026 at 7:21 am

    Why not adding a parameter, to be used only on the first call?

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
        version="1.0">
    
        <xsl:output method="xml" indent="yes"/>
        <xsl:strip-space elements="*"/>
    
        <xsl:template match="/test">
            <xsl:call-template name="GetDisplay_1">
                <xsl:with-param name="input" select="'the_brown_fox'"/>
                <xsl:with-param name="start" select="'start'"/>
            </xsl:call-template>
        </xsl:template>
    
        <xsl:template name="GetDisplay_1">
            <xsl:param name="input"/>
            <xsl:param name="start" select="''"/>
    
            <xsl:choose>
    
                <xsl:when test="$start='start'">
                    <xsl:text>|</xsl:text>
                    <xsl:call-template name="GetDisplay_1">
                        <xsl:with-param name="input" select="$input"/>
                    </xsl:call-template>
                    <xsl:text> |</xsl:text>
                </xsl:when>
    
                <xsl:otherwise>
                    <xsl:text> </xsl:text>
                    <xsl:call-template name="GetUpper">
                        <xsl:with-param name="input" select="substring($input,1,1)"/>
                    </xsl:call-template>
                    <xsl:variable name="head" select="substring-before($input,'_')"/>
    
                    <xsl:choose>
                        <xsl:when test="$head=''">
                            <xsl:value-of select="substring($input,2)"/>
                        </xsl:when>
                        <xsl:otherwise>
                            <xsl:value-of select="substring($head,2)"/>
                            <xsl:call-template name="GetDisplay_1">
                                <xsl:with-param name="input" select="substring-after($input,'_')"/>
                            </xsl:call-template>
                        </xsl:otherwise>
                    </xsl:choose>
                </xsl:otherwise>
    
            </xsl:choose>
        </xsl:template>
    
        <xsl:template name="GetUpper">
            <xsl:param name="input"/>
            <xsl:value-of select="translate($input,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/>
        </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it OK to pass XML to an XSL template through a parameter? For
This is my very first attempt at dealing with XSL, so please be kind
First attempt to use this cool site - after searching for 2 hours: So
My attempt to customize the method contains of ArrayList, I used Eclipse to generate
I attempt to use webservice return POCO class generated from entity data model as
The following is my attempt at a prepare statement. It is causing the page
In an attempt to achieve git nirvana, I'm spending the day learning how to
This is my first attempt at responsive design, so I'm keeping it simple. I
When I attempt to deserialize: { tags: {} } into: public static class Foo
When I attempt to connect to an intranet web service from a web application

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.