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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:10:28+00:00 2026-05-18T11:10:28+00:00

is there a way to convert all nodes’ attributes into child Nodes using XSLT

  • 0

is there a way to convert all nodes’ attributes into child Nodes using XSLT 1.0 ?
It must run flawlessly with PHP’s xsltProcessor. The attributes must be removed (if possible).

Example input :

<root aaa="111" bbb="222" ccc="333">
    <bob ddd="444" />

    <data eee="555">
        <steve>bar1</steve>
        <john>bar2</john>
        <peter fff="666">bar3</peter>
    </data>

    <greg ggg="777" />
</root>

The desired result :

<root>
    <aaa>111</aaa>
    <bbb>222</bbb>
    <ccc>333</ccc>
    <bob>
        <ddd>444</ddd>
    </bob>
    <data>
        <eee>555</eee>
        <steve>bar1</steve>
        <john>bar2</john>
        <peter>
            <fff>666</fff>
            bar3
        </peter>
    </data>
    <greg>
        <ggg>777</ggg>
    </greg>
</root>

Thank you!

  • 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-18T11:10:29+00:00Added an answer on May 18, 2026 at 11:10 am

    Tested on Oxygen/XML using Saxon6.5:

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:output method="xml" indent="yes"/>
    
      <xsl:template match="node()">
        <xsl:copy>
          <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="@*">
        <xsl:element name="{name()}"><xsl:value-of select="."/></xsl:element>
      </xsl:template>
    
    </xsl:stylesheet>
    

    This is based on using an identity template for element nodes and a template that converts attributes to elements.

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

Sidebar

Related Questions

Is there a way I can convert ALL characters, including regular ones, using PHP
Is there a way to convert a HTML string into a Image .tiff file?
Is there a way to convert an integer to a string in PHP?
Is there a way to convert HTML into XAML? I noticed that you can
Is there a way to convert @my_variable string into a value of @my_variable ?
Is there a way to convert a list of values into a comma-delimited string
is there a way to convert my recorded .caf files to .mp3 using the
Is there an easy way to convert all the columns of the current row
Is there an easy way to get the MvcRouteHandler to convert all hyphens in
Is there a way to convert FLA or SWF into SVG format? It can

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.