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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:19:53+00:00 2026-05-20T10:19:53+00:00

I have transformed one XML file to an another XML file (in desired structure)

  • 0

I have transformed one XML file to an another XML file (in desired structure) using XSLT. However i am unable to view the transformed file in XML format. It shows me plain text values.

This is my original XML file :

<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="xsl.xsl"?>
<NewDataSet>
<Table>
 <IMPORT_ID>2</IMPORT_ID>
 <SEQ_NO>1</SEQ_NO>
 <LEVEL_TAG>RANDOMISATIONDATA</LEVEL_TAG>
 <INSERTED>2004-01-21T12:42:53+05:30</INSERTED>
 <INSERTED_BY>kfsv433</INSERTED_BY>
</Table>
   </NewDataSet>

And i coverted it to my desired output using the following 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" version="1.0" indent="yes"/> 
<xsl:strip-space elements="*"/> 
  <xsl:template match="/"> 
  <xsl:apply-templates /> 
 </xsl:template> 
 <xsl:template match="IMPORT_ID"> 
 <IMPORT_ID SEQ_NO="{SEQ_NO/text()}"/> 
 </xsl:template> 
</xsl:stylesheet>

I get the output as

1RANDOMISATIONDATA2004-01-21T12:42:53+05:30kfsv433

I can see that what ever XSLT i have implemented is showing the correct result but i need to get this in XML format.

Kindly help me.

  • 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-20T10:19:53+00:00Added an answer on May 20, 2026 at 10:19 am

    I think you want this:

    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
        <xsl:output method="xml" version="1.0" indent="yes"/>
        <xsl:strip-space elements="*"/>
        <xsl:template match="/">
            <xsl:apply-templates />
        </xsl:template>
        <xsl:template match="IMPORT_ID">
            <IMPORT_ID SEQ_NO="{following-sibling::SEQ_NO[1]/text()}"/>
        </xsl:template>
    
        <xsl:template match="text()"/>
    </xsl:stylesheet>
    

    when this transformation is applied on the provided XML document:

    <NewDataSet>
        <Table>
            <IMPORT_ID>2</IMPORT_ID>
            <SEQ_NO>1</SEQ_NO>
            <LEVEL_TAG>RANDOMISATIONDATA</LEVEL_TAG>
            <INSERTED>2004-01-21T12:42:53+05:30</INSERTED>
            <INSERTED_BY>kfsv433</INSERTED_BY>
        </Table>
    </NewDataSet>
    

    the wanted result is produced:

    <IMPORT_ID SEQ_NO="1"/>
    

    Explanation:

    1. All text nodes are matched by a template with empty body, which overrides the default XSLT processing, so the text nodes are now not copied to the output.

    2. SEQ_NO is not a child of IMPORT_ID — it is a sibling.

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

Sidebar

Related Questions

I have an XML file that I want to transform using an XSLT. It
I have an XML document which I'm subjected to an XSLT. The structure is
I have two XML files to render one page in XSLT. This is because
I have several xml files, the names of which are stored in another xml
I have an xml file which describes (among other things) elements with attribute values
I have developed an XSL file that transforms xml files into a html table.
here's a tricky one. I have the following XML <test> <testElement SomeAttribute=<otherxml><otherElement>test test</otherElement></otherxml>> </testElement>
I have an XML file which has some values in child Element aswell in
i have multiple Xml files, in a List<File> . What i want is to
Im completely new to XML/XSL/XSLT, and while i have been digging msdn, 3schools.com and

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.