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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:00:38+00:00 2026-06-08T19:00:38+00:00

I have to transform my string in a peculiar way, as the string contains

  • 0

I have to transform my string in a peculiar way, as the string contains many hex values and replacement has to be applied based on some conditions.

My string contains hex values.

Always the length of string, will be a multiple of 18. The string can contain from 1* 18 to 5000*18 times(1 group to 5000 groups).

Now my output is a transformed string based on the below conditions

1) Check if the groups 13th character is 4e(13th and 14th character)


  Then, change such a way that starting from 7th to 10th character(4 chars) of the string, from whatever the value is to '4040'


    Also change starting from 11th till 16th(6 chars) to '4ef0f0'
    The 17th and 18th to be '4040'

   The whole group to be changed based on the above


2) If the check fails, no change for the group

Example if my input string is – one group and the 12th and 13th are ‘4e’

<xsl:variable name="inputstringhex"
      select="'005f6f7e8f914e7175'"/>

It should be tranformed to

'005f6f40404ef0f04040'

I am using xslt1.0, and I can use only Divide and conquer method(if any recursion is used), as my xslt processor errors out if tail recursive method is used, for a large number.

  • 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-08T19:00:40+00:00Added an answer on June 8, 2026 at 7:00 pm

    You can use binary-log recursion (perhaps that is what you mean by divide and conquer? Any way, this XSLT 1.0 style-sheet…

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" indent="yes"/>
    <xsl:strip-space elements="*" />
    
    <xsl:variable name="inputstringhex"
          select="'005f6f7e8f914e717512346f7e8f914e7175'"/>
    
    <xsl:template match="/">
      <t>
        <xsl:call-template name="string18s">
          <xsl:with-param name="values" select="$inputstringhex" />
        </xsl:call-template>
      </t>  
    </xsl:template>
    
    <xsl:template name="string18s">
      <xsl:param name="values" />
      <xsl:variable name="value-count" select="string-length($values) div 18" />
      <xsl:choose>
        <xsl:when test="$value-count = 0" />
        <xsl:when test="$value-count &gt;= 2">
          <xsl:variable name="half-way" select="floor( $value-count div 2) * 18" />
          <xsl:call-template name="string18s">
            <xsl:with-param name="values" select="substring( $values, 1, $half-way)" />
          </xsl:call-template>
          <xsl:call-template name="string18s">
            <xsl:with-param name="values" select="substring( $values,
             $half-way+1, string-length($values) - $half-way)" />
          </xsl:call-template>      
        </xsl:when>  
        <xsl:otherwise>
          <xsl:call-template name="process-one-string18">
            <xsl:with-param name="value" select="$values" />
          </xsl:call-template>
        </xsl:otherwise>  
      </xsl:choose>
    </xsl:template>
    
    <xsl:template name="process-one-string18">
      <xsl:param name="value" />
      <v>
       <xsl:choose>
        <xsl:when test="substring( $value, 13, 2) = '4e'"> 
          <xsl:value-of select="concat( substring( $value, 1, 6),
                                        '40404ef0f04040')" />
        </xsl:when> 
        <xsl:otherwise>
          <xsl:value-of select="$value" />
        </xsl:otherwise> 
       </xsl:choose>
      </v>  
    </xsl:template>
    
    </xsl:stylesheet>
    

    …will produce this output…

    <t>
      <v>005f6f40404ef0f04040</v>
      <v>12346f40404ef0f04040</v>
    </t> 
    

    Adapt or concatenate values of the output as required. The input is the $inputstringhex variable content. A 5000*18 length input string can be processed in only 13 levels of recursion using this solution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string of style transform given in the following way : matrix(0.312321,
I have a string: 'Some_string_to_capitalize' which I would like to transform to 'Some_String_To_Capitalize'. I
I have: NSString *promise = @thereAreOtherWorldsThanThese; which I'm trying to transform into the string:
I have a string Word1 Word2 and I want to transform it to a
I wonder if anyone has an idea how you have to transform an image
I have a list of integer ASCII values that I need to transform into
Let's say I have a number (e.g. double) and transform it using some format
I have an XML Object and when I transform it to string with public
I'm looking for an elegant way to transform an std::string from something like: std::string
I have a numeric string like this 2223,00 . I would like to transform

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.