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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:15:32+00:00 2026-05-31T09:15:32+00:00

I am working on XML to XML transformations through XSLT. I want to extract

  • 0

I am working on XML to XML transformations through XSLT.

I want to extract aprtial value from an element and assign that as attribute to new element.

Source XML:

      <content>
        <component>
      <aaa>HI
           <strong>[a_b_c]</strong>
              : More Information Needed
            <strong>[d_e_f]</strong>XXX
      </aaa>
     </component>
     <content>

Target XML:

    <ddd>hi<dv name='a_b_c'/>: More Information Needed <dv name='d_e_f'/> XXX

    </ddd>

can any one suggest how to do it through XSLT.

Thank you in advance.

  • 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-31T09:15:33+00:00Added an answer on May 31, 2026 at 9:15 am

    XSLT 1.0

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output indent="yes"/>
      <xsl:strip-space elements="*"/>
    
      <xsl:template match="aaa">
        <ddd>
          <xsl:value-of select="substring-before(.,'[')"/>
          <dv name="{substring-before(substring-after(.,'['),']')}"/>
        </ddd>
      </xsl:template>
    
    </xsl:stylesheet>
    

    or

    XSLT 2.0

    <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output indent="yes"/>
      <xsl:strip-space elements="*"/>
    
      <xsl:template match="aaa">
        <ddd>
          <xsl:value-of select="tokenize(.,'\[')[1]"/>
          <dv name="{tokenize(tokenize(.,'\[')[2],'\]')[1]}"/>
        </ddd>
      </xsl:template>
    
    </xsl:stylesheet>
    

    EDIT

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output indent="yes"/>
      <xsl:strip-space elements="*"/>
    
      <xsl:template match="node()|@*">
        <xsl:copy>
          <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="aaa">
        <ddd>
          <xsl:apply-templates select="node()|@*"/>
        </ddd>
      </xsl:template>
    
      <xsl:template match="content|component">
        <xsl:apply-templates/>
      </xsl:template>
    
      <xsl:template match="strong">
        <dv name="{normalize-space(.)}"/>
      </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on XML to XML transformations through XSLT. I want to remove
I am new to XSLT working on XML to XML transformation. I want to
I'm currently working on a project which uses XSL-Transformations to generate HTML from XML.
I'm working on a XSLT transformation that consists on merging two XML and then
I am working on XSLT transformations. I am stuck at one point. Source XML:
I am fetching XML data from server i want that when data is loading
I'm working with XML that was designed by somebody who got paid by the
I'm working with XML data from an application where we get XML like this:
I'm relatively new to working with XML and am working with some rather large
I'm working with an XML document that contains a structure that looks similar to

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.