need to manipulate the tag with xsl

Hi I have the below xml


 <Summary>
      <b>\fs130.This is a summary.</b><br />\fs100. inside this letter.
</Summary>
 
 
Need to update the xml as below
 
  <Summary><body xmlns="http://www.w3.org/1999/xhtml"><p><span style="font-weight:bold;font-size:13pt">This is a summary.</span></p><p><span style="font-weight:normal;font-size:10pt"> inside this letter.</span></p></body></Summary>

Please let me know if this can be done. Thanks in advance.
sri1209Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Gertone (Geert Bormans)Information ArchitectCommented:
Interesting use-case, though a bit advanced

I made a solution that almost does it,
but I would suggest to get the normal span to have a two-pass
(or allow the b-span nested inside a plain span)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    
    <xsl:template match="*">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="text()">
        <xsl:call-template name="process-text"/>
    </xsl:template>

    <xsl:template match="text()" mode="next">
        <xsl:call-template name="process-text"/>
    </xsl:template>
    
    <xsl:template name="process-text">
        <xsl:choose>
            <xsl:when test="starts-with(normalize-space(.), '\fs' )">
                <xsl:value-of select="substring(normalize-space(.), 8) "/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="."/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
    
    <xsl:template match="Summary"><!-- put all elements here that require "html" treatment -->
        <xsl:copy-of select="@*"/>
        <xsl:copy>
            <body xmlns="http://www.w3.org/1999/xhtml">
                <xsl:apply-templates select="node()[1]" mode="startpoint"/>
            </body>
        </xsl:copy>
    </xsl:template>
    
    <xsl:template match="*" mode="startpoint">
        <p xmlns="http://www.w3.org/1999/xhtml">
            <xsl:copy>
                <xsl:copy-of select="@*"/>
                <xsl:apply-templates select="node()"/>
            </xsl:copy>
            <xsl:apply-templates select="following-sibling::node()[1]" mode="next"/>
        </p>
        <xsl:apply-templates select="following-sibling::br[1]/following-sibling::node()[1]" mode="startpoint"/>
    </xsl:template>
    
    <xsl:template match="text()" mode="startpoint">
        <p xmlns="http://www.w3.org/1999/xhtml">
            <xsl:call-template name="process-text"/>
            <xsl:apply-templates select="following-sibling::node()[1]" mode="next"/>
        </p>
        <xsl:apply-templates select="following-sibling::br[1]/following-sibling::node()[1]" mode="startpoint"/>
    </xsl:template>
    
    
    <xsl:template match="node()" mode="next">
        <xsl:copy>
            <xsl:copy-of select="@*"/>
            <xsl:apply-templates select="node()"/>
        </xsl:copy>
        <xsl:apply-templates select="following-sibling::node()[1]" mode="next"/>
    </xsl:template>
    
    <xsl:template match="br" mode="next"/>
    
    <xsl:template match="b" mode="next">
        <span style="font-weight:bold;font-size:13pt" xmlns="http://www.w3.org/1999/xhtml">
            <xsl:apply-templates select="node()"/>
        </span>
    </xsl:template>
    
    
</xsl:stylesheet>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sri1209Author Commented:
Thank you very much, works great.
0
Gertone (Geert Bormans)Information ArchitectCommented:
Welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.