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

  • Home
  • SEARCH
  • 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 8554495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:53:44+00:00 2026-06-11T14:53:44+00:00

I need to transform the following XML to XML that has the same elements

  • 0

I need to transform the following XML to XML that has the same elements and attributes except for values that can be localized – basically English phrases.

Some of the elements (<footnote>) and attributes are optional (<display_data_type>), and I’d like to be able to do this generically – without having a template for each element. Is that possible?

The ultimate goal is to be able compare the default version of the XML with a localized version, ignoring the localized strings.

For example the following:

<data_schema>
    <field symbol="ACCOUNT" type="string" name="Account Number">
        <validators>
            <maxlength>6</maxlength>
        </validators>
        <description>The account number</description>
        <example>123456</example>
        <default_value></default_value>
    </field>
    <field symbol="POSTAL_CODE" type="string" name="Postal Code">
        <description>Postal Code for account</description>
        <example>22022</example>
        <footnote>Does not apply to certain accounts</footnote>
        <default_value></default_value>
    </field>
    <field symbol="DISCOUNT" type="string" name="Discount Percentage" display_data_type="percentage">
        <description>Descount determined by account</description>
        <example>1.5%</example>
        <default_value></default_value>
    </field>
</data_schema>

would be converted to:

<data_schema>
    <field symbol="ACCOUNT" type="string" name="">
        <validators>
            <maxlength>6</maxlength>
        </validators>
        <description/>
        <example/>
        <default_value/>
    </field>
    <field symbol="POSTAL_CODE" type="string" name="">
        <description/>
        <example/>
        <footnote/>
        <default_value/>
    </field>
    <field symbol="DISCOUNT" type="string" name="" display_data_type="percentage">
        <description/>
        <example/>
        <default_value/>
    </field>
</data_schema>
  • 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-11T14:53:45+00:00Added an answer on June 11, 2026 at 2:53 pm

    Here’s an example. A template like this, when applied, should create a copy of the tree, minus the text areas and attribute text for attributes that are not symbol or type.

    <xsl:template match="*">
      <xsl:element name="{name()}">
        <xsl:for-each select="@*">
          <xsl:choose>
            <xsl:when test="name() = 'symbol' or name() = 'type'">
              <xsl:copy-of select="."/>
            </xsl:when>
            <xsl:otherwise>
              <xsl:attribute name="{name()}"/>
            </xsl:otherwise>
          </xsl:choose>
        </xsl:for-each>  
    
        <xsl:apply-templates select="*"/>
      </xsl:element>
    </xsl:template>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a following XML structure that I need to transform: <recordset rowCount=68 fieldNames=ITEM,ECL,LEAD_TIME
I need to transform a list into dictionary as follows. The odd elements has
I am developing an application were I need to transform XML documents that look
I have the following XML example that I need some help on. The sample
I have a simple xml document that looks like the following snippet. I need
Im working with PHP5, and I need to transform XML in the following form:
I need to transform a valid XML document to the OFX v1.0.2 format .
I am having some problems with an XML transform and need some help. The
I need to transform an XML file to another XML file, where the source
I'm attempting to remove Component elements from the XML below that have File children

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.