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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:51:25+00:00 2026-06-15T04:51:25+00:00

This is just info sharing. I already know the solution :) I did it

  • 0

This is just info sharing. I already know the solution 🙂 I did it the hard way !! I want two things here:

  1. To share what I reached so far.
  2. To know if anyone has a better solution
  • 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-06-15T04:51:28+00:00Added an answer on June 15, 2026 at 4:51 am
    <xsl:template name="break-to-length">
        <xsl:param name="text" />
        <xsl:param name="length" />
        
        <xsl:variable name="first-half" select="substring($text,0,$length)" />
        <xsl:variable name="second-half" select="substring-after($text, $first-half)" />
        
        <xsl:variable name="last-five-chars-of-first-half" select="substring-after($first-half,substring($first-half, 0, $length - 5))" />
        
        <xsl:variable name="alternative-first-half">
            <xsl:choose>
                <xsl:when test="contains($last-five-chars-of-first-half, $space)">
                    <xsl:value-of select="concat(substring($first-half, 0, $length - 5), substring-before($last-five-chars-of-first-half, $space))" />
                </xsl:when>
                <xsl:when test="contains($last-five-chars-of-first-half, $dot)">
                    <xsl:value-of select="concat(substring($first-half, 0, $length - 5), substring-before($last-five-chars-of-first-half, $dot), $dot)" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$first-half" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        
        <xsl:variable name="alternative-second-half">
            <xsl:choose>
                <xsl:when test="contains($last-five-chars-of-first-half, $space)">
                    <xsl:value-of select="concat(substring-after($last-five-chars-of-first-half, $space), $second-half)" />
                </xsl:when>
                <xsl:when test="contains($last-five-chars-of-first-half, $dot)">
                    <xsl:value-of select="concat(substring-after($last-five-chars-of-first-half, $dot), $second-half)" />
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="$second-half" />
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        
        <!-- if first half doesn't end with a space or dot -->
        <xsl:variable name="word-was-cut" select="$alternative-first-half = $first-half" />
        
        <xsl:value-of select="$alternative-first-half" />
        
        <xsl:choose>
            <xsl:when test="string-length($alternative-second-half) = 0">
                <!-- Do Nothing -->
            </xsl:when>
            <xsl:when test="string-length($alternative-second-half) &lt; $length">
                <!-- if first half doesn't end with a space or dot -->
                <xsl:if test="$word-was-cut">
                    <xsl:text>-</xsl:text>
                </xsl:if>
                <fo:block />
                <xsl:value-of select="$alternative-second-half" />
            </xsl:when>
            <xsl:otherwise>
                <!-- Second half is longer than max length -->
                <!-- if first half doesn't end with a space -->
                <xsl:if test="$word-was-cut">
                    <xsl:text>-</xsl:text>
                </xsl:if>
                <fo:block />
                <xsl:call-template name="break-to-length">
                    <xsl:with-param name="text" select="$alternative-second-half"/>
                    <xsl:with-param name="length" select="$length" />
                </xsl:call-template>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This will probably be just another unsolved thread but i'll fill in some info
This just saves time. Since I already have a web applciation. I can just
Let me preface this by saying that I know the ContactCenter sample is just
Skip to the bottom for the question; this is just some extra info I
This was at a community college. I failed it, but want to know the
This just started happening three weeks or so ago. The content of my website
I fear this just may not be possible, but I'm trying to create a
I'm hoping this just needs a new pair of eyes casting over it. I
So for some reason this just doesn't make sense to me. What Im trying
I assume this just returns an int. Is there anything else going on I

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.