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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T08:32:25+00:00 2026-06-09T08:32:25+00:00

Input: <text> Please see the registered mark® . Please see the copy right ©.

  • 0

Input:

<text>
    Please see the registered mark® .
    Please see the copy right ©.
    Please see the Trade mark™.
</text>

Output:

  <text>
        Please see the registered mark<registeredTrademark></registeredTrademark>.
        Please see the copy right <copyright></copyright>.
        Please see the Trade mark <trademark></trademark>.
  </text>

I need to replace all special symbols with the elements as shown above

Can any one help.

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-06-09T08:32:26+00:00Added an answer on June 9, 2026 at 8:32 am

    This transformation is more efficient by avoiding char-by-char recursion and using “biggest-possible-step” recursion:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns:my="my:my">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
    
     <my:reps>
      <r char="®">registeredTrademark</r>
      <r char="©">copyright</r>
      <r char="™">trademark</r>
     </my:reps>
    
     <xsl:variable name="vReps" select="document('')/*/my:reps/*"/>
    
     <xsl:template match="text()" name="multReplace">
      <xsl:param name="pText" select="."/>
      <xsl:param name="pReps" select="$vReps"/>
    
       <xsl:if test="$pText">
         <xsl:variable name="vTarget" select="$pReps[1]/@char"/>
           <xsl:choose>
             <xsl:when test="not($vTarget)">
               <xsl:value-of select="$pText"/>
             </xsl:when>
             <xsl:otherwise>
               <xsl:variable name="vReplacement" select="$pReps[1]"/>
    
               <xsl:call-template name="multReplace">
                <xsl:with-param name="pText" select=
                "substring-before(concat($pText, $vTarget), $vTarget)"/>
                <xsl:with-param name="pReps" select="$pReps[position() >1]"/>
               </xsl:call-template>
    
               <xsl:if test="contains($pText, $vTarget)">
                 <xsl:element name="{$vReplacement}"/>
                 <xsl:call-template name="multReplace">
                  <xsl:with-param name="pText" select="substring-after($pText, $vTarget)"/>
                  <xsl:with-param name="pReps" select="$pReps"/>
                 </xsl:call-template>
               </xsl:if>
             </xsl:otherwise>
           </xsl:choose>
       </xsl:if>
     </xsl:template>
    </xsl:stylesheet>
    

    When applied to the provided XML document:

    <text>
            Please see the registered mark® .
            Please see the copy right ©.
            Please see the Trade mark™.
    </text>
    

    the correctly-replaced text is produced:

        Please see the registered mark<registeredTrademark/> .
        Please see the copy right <copyright/>.
        Please see the Trade mark<trademark/>.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to define text spacing in input in css. Please help
I have input text: <div><label wicket:for=name>Name</label><input type=text wicket:id=name /></div> Now I need to add
Please see the form HTML code below <form method=post action=register> <div class=email> Email <input
could someone help me please and see where I am going wrong? <script type=text/javascript>
Please see my answer to this question below. It is based upon Kevin's input,
I need to accept arbitrary user input. Later, I want to copy that input,
For input text files, I know that .seek and .tell both operate with bytes,
I have this input text and an input button...I am looking to have them
I have this input text and input button, I am trying to get them
I have multiple input text fields grouped in divs: <div class=container0> <input class=containerItem0 name=containerItem[0][0]

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.