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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:03:37+00:00 2026-06-02T18:03:37+00:00

I am working on XSLT. Source XML: <?xml version=1.0 encoding=iso-8859-1?> <Content> <alertHeader> <ol xmlns=http://www.w3.org/1999/xhtml>

  • 0

I am working on XSLT.

Source XML:

           <?xml version="1.0" encoding="iso-8859-1"?>
            <Content>
              <alertHeader>


                <ol xmlns="http://www.w3.org/1999/xhtml">
                  <li>
                    <strong>Review</strong>
                    your current available balance. It can be obtained 24 hours a day, 7 days a week through
                    <a href="/ALL_UNDER_123">Account Activity</a>
                    any 123 ATM or by calling
                    <a id="dynamicvariable" href="#" name="Customercare">[Customercare]</a>
                    at
                    <a id="dynamicvariable" href="#" name="contactNo">[contactNo]</a>
                    .
                  </li>
                  <li>
                    <strong>Take into consideration</strong>


                    <ul>
                      <li>Please get in touch with us</li>
                      <li>Please consider this as important info</li>
                    </ul>


                  </li>
                  <li>
                    <strong>Current</strong>
                    Statementt doesnot match the requirement
                    <a id="dynamicvariable" href="#" name="Actual acccount">[Actual acccount]</a>
                    ,plus
                    <a id="dynamicvariable" href="#" name="totalcharges">[totalcharges]</a>
                    Make u r response as positive.
                  </li>
                </ol>
                <p xmlns="http://www.w3.org/1999/xhtml"></p>
                <div xmlns="http://www.w3.org/1999/xshtml"></div>
                <span xmlns="http://www.w3.org/1999/xshtml"></span>



              </alertHeader>
            </Content>

I want to write a XSLT to pass entire content in the tag alertHeader as value to another template.

I want to modify this code as follows.

                   1.Remove the tags   <p></p>, and <div></div>,<span></span> and <a></a>. I want to remove only tags but not the value of the tags. It should be there as it is.
                   2.Pass the content including tags to "Process" template.

Output required:

          <aaa>
            <text>

            <ol xmlns="http://www.w3.org/1999/xhtml">
              <li>
                    <strong>Review</strong>
                    your current available balance. It can be obtained 24 hours a day, 7 days a week through
                <dynamicvariable name="Customercare"/>

                at
                <dynamicvariable name="contactNo"/>

                .
              </li>
              <li>
                    <strong>Take into consideration</strong>


                    <ul>
                      <li>Please get in touch with us</li>
                      <li>Please consider this as important info</li>
                    </ul>


                  </li>
              <li>
                <strong>Current</strong>
                    Statementt doesnot match the requirement
              </li>
            </ol>
            </text>
          </aaa>

current XSLT:

              <?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" indent="yes"/>


                <xsl:template match="alertHeader">
                  <xsl:call-template name="process">

                    <xsl:with-param name="text" select="." />


                  </xsl:call-template>

                </xsl:template>
                <xsl:template name="process">
                  <xsl:param name="text" />

                  <xsl:variable name="head" select="substring-before($text, '[')" />
                  <xsl:variable name="tag" select="substring-before(substring-after($text, '['), ']')" />
                  <xsl:variable name="tail" select="substring-after($text, ']')" />

                  <xsl:choose>
                    <xsl:when test="$head != '' and $tag != ''">
                      <xsl:value-of select="$head" />
                      <dynamicVariable name="{$tag}" />
                      <!-- recursive step: process the remainder of the string -->
                      <xsl:call-template name="process">
                        <xsl:with-param name="text" select="$tail" />
                      </xsl:call-template>
                    </xsl:when>
                    <xsl:otherwise>
                      <xsl:value-of select="$text" />
                    </xsl:otherwise>
                  </xsl:choose>
                </xsl:template>

              </xsl:stylesheet>

Can any one say what all the changes required for my code.

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-02T18:03:37+00:00Added an answer on June 2, 2026 at 6:03 pm

    The problem in xslt-1.0 is that you can’t access a result node or nodeset, as in there is no XPath or function or anything to refer to the transformation result of a template.

    Is it essential that you call process as it is? The way I’d go about this is to make process a template that transforms exactly one node, and then call it from every node below alertHeader, like:

    <xsl:template match="alertHeader">
      <!-- switch modes so we know we need to call process -->
      <xsl:apply-templates mode="callproc"/>
    </xsl:template>
    
    <xsl:template match="*" mode="callproc">
      <!-- call process on THIS node -->
      <xsl:call-template name="process">
        <xsl:with-param name="text" select="."/>
      </xsl:call-template>
      <!-- descend -->
      <xsl:apply-templates mode="callproc"/>
    </xsl:template>
    
    <!-- all the stuff that needs stripping -->
    <xsl:template match="p|div|span|a" mode="callproc">
      <!-- call process on the text() portion -->
      <xsl:call-template name="process">
        <xsl:with-param name="text" select="text()"/>
      </xsl:call-template>
      <!-- no descent here -->
    </xsl:template>
    

    Update:
    Without process template

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xh="http://www.w3.org/1999/xhtml"
      xmlns:xsh="http://www.w3.org/1999/xshtml">
    
      <xsl:output method="xml" indent="yes"/>
    
      <xsl:template match="Content">
        <xsl:apply-templates/>
      </xsl:template>
    
      <xsl:template match="alertHeader">
        <xsl:element name="aaa">
          <xsl:element name="text">
            <!-- switch modes so we know we need to call process -->
            <xsl:apply-templates/>
          </xsl:element>
        </xsl:element>
      </xsl:template>
    
      <xsl:template match="*">
        <xsl:copy>
          <!-- descend -->
          <xsl:apply-templates/>
        </xsl:copy>
      </xsl:template>
    
      <!-- all the stuff that needs stripping -->
      <xsl:template match="xh:p|xh:div|xh:span|xsh:div|xsh:span">
        <xsl:apply-templates/>
      </xsl:template>
    
      <!-- was process -->
      <xsl:template match="xh:a[@name]">
        <xsl:element name="dynamicvariable" namespace="http://www.w3.org/1999/xhtml">
          <xsl:attribute name="name">
            <xsl:value-of select="@name"/>
          </xsl:attribute>
        </xsl:element>
      </xsl:template>
    
      <xsl:template match="xh:a"/>
    
      <xsl:template match="text()">
        <xsl:value-of select="."/>
      </xsl:template>
    
    </xsl:stylesheet>
    

    Output:

                    <ol xmlns="http://www.w3.org/1999/xhtml">
                <li>
                    <strong>Review</strong>
                    your current available balance. It can be obtained 24 hours a day, 7 days a week through
    
                    any Wells Fargo ATM or by calling
                    <dynamicvariable name="Call_Center_Name"/>
                    at
                    <dynamicvariable name="Phone_Number"/>
                    .
                </li>
                <li>
                    <strong>Take into account</strong>
    
    
                    <ul>
                        <li>Your pending transactions and any additional transactions that have not yet been deducted from your available balance, such as checks you have written or upcoming scheduled automatic payments.</li>
                        <li>Any transactions that have been returned because you did not have enough money in your account at that time; they may be resubmitted for payment by the person or party who received the payment from you</li>
                    </ul>
    
    
                </li>
                <li>
                    <strong>Deposit</strong>
                    enough money to establish and maintain a positive account balance. A deposit of at least
                    <dynamicvariable name="Absolute_Available_Balance"/>
                    ,plus
                    <dynamicvariable name="Total_Fee"/>
                    in fees, would have been required to make your account balance positive at the time we sent this notice.
                </li>
                    </ol>
    
    
    
    
    
    
        </text>
    </aaa>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on XSLT. I have this XML source file : <?xml version=1.0 encoding=UTF-8?>
I am working on this from xslt cookbook type my.xml <?xml version=1.0 encoding=UTF-8?> <people>
I am working with an open source version of the Saxon XSLT processor Saxon
I am working on XSLT transformations. I am stuck at one point. Source XML:
I'm working on an application that uses XSLT to transform XML generated by JSP.
I'm working on a XSLT transformation that consists on merging two XML and then
I am working on XML to XML transformations through XSLT. I want to remove
I have the following XML: <?xml version=1.0 encoding=utf-8 ?> <ApplicationSettingCategories> <Category>Cat1</Category> <Category>Cat2</Category> <Category>Cat3</Category> <Category>Cat4</Category>
XSLT available is 1.0. I'm working on a dual-language site in an XML-based CMS
I am new to XSLT working on XML to XML transformation. I want 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.