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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:26:21+00:00 2026-06-01T15:26:21+00:00

I have an xml in following form: <?xml version=1.0 encoding=UTF-8?> <query> <queryParams name=accountID>Star TV</queryParams>

  • 0

I have an xml in following form:

<?xml version="1.0" encoding="UTF-8"?>
<query>
    <queryParams name="accountID">Star TV</queryParams>
    <queryParams name="assetID">Friends</queryParams>
    <queryParams name="accountExtRef">Tata</queryParams>
</query>

I need separate xslt to:

  1. replace name=”providerID” with name=”ContentProvider” such that the
    resulting xml becomes:

    <?xml version="1.0" encoding="UTF-8"?>
    <query>
        <queryParams name="companyID">Star TV</queryParams>
        <queryParams name="assetID">Friends</queryParams>
        <queryParams name="accountExtRef">Tata</queryParams>
    </query>
    
  2. replace “Star TV” with Colors such that the XML becomes

        <?xml version="1.0" encoding="UTF-8"?>
        <query>
            <queryParams name="accountID">Colors</queryParams>
            <queryParams name="assetID">Friends</queryParams>
            <queryParams name="accountExtRef">Tata</queryParams>
        </query>
    

Please help.

  • 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-01T15:26:22+00:00Added an answer on June 1, 2026 at 3:26 pm

    You could do this by simply adding extra templates to the identity transform to match the changes you need.

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       <xsl:output method="xml" indent="yes"/>
    
       <xsl:template match="@*|node()">
          <xsl:copy>
             <xsl:apply-templates select="@*|node()"/>
          </xsl:copy>
       </xsl:template>
    
       <xsl:template match="queryParams/@name[. = 'accountID']">
          <xsl:attribute name="name">companyID</xsl:attribute>
       </xsl:template>
    
       <xsl:template match="queryParams/text()[. = 'Star TV']">
          <xsl:text>Colors</xsl:text>
       </xsl:template>
    </xsl:stylesheet>
    

    When applied to your sample XML, the following is output

    <query>
       <queryParams name="companyID">Colors</queryParams>
       <queryParams name="assetID">Friends</queryParams>
       <queryParams name="accountExtRef">Tata</queryParams>
    </query>
    

    In this case, it does both changes in one go, but it should be clear enough how to split this into two separate XSLTs if required.

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

Sidebar

Related Questions

I have the following HTML code: <?xml version=1.0 encoding=utf-8 ?> <!DOCTYPE html PUBLIC -//W3C//DTD
I have the following XML file: <?xml version='1.0' encoding='utf-8'?> <Answers> <Question1 q=What is your
I have the following XML file: <?xml version='1.0' encoding='utf-8'?> <Answers> <Question1 q=What is your
I have the following JSF table: <?xml version=1.0 encoding=UTF-8?> <!DOCTYPE html PUBLIC -//W3C//DTD XHTML
I have an XSD of this form: <?xml version=1.0 encoding=UTF-8?> <schema xmlns=http://www.w3.org/2001/XMLSchema targetNamespace=http://www.example.org/example xmlns:tns=http://www.example.org/example
i want to post xml data in following format: <?xml version=1.0 encoding=UTF-8?> <data> <email>xyz@domain.com</email>
Picture the following situation. I have an XML document as follows, <Form> <Control Type=Text
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
I have the following XML structure: <?xml version=1.0 ?> <course xml:lang=nl> <body> <item id=787900813228567
I have the following xml I'd like to deserialize into a class <?xml version=1.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.