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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T18:40:05+00:00 2026-06-06T18:40:05+00:00

I have a XML file of: <?xml version=1.0 encoding=utf-8?> <Batch BatchID=896 BatchName=20120629.130504> <Document DocumentType=XML

  • 0

I have a XML file of:

<?xml version="1.0" encoding="utf-8"?>
<Batch BatchID="896" BatchName="20120629.130504">
    <Document DocumentType="XML Question">
        <Fields>
            <Field FieldName="Doc_ID">1</Field>
            <Field FieldName="Vendor_Code">126400</Field>
            <Field FieldName="Property_Code">10519</Field>
            <Field FieldName="Invoice_Num">20509</Field>
        </Fields><Files />
    </Document>
</Batch>

and I want to convert it to look something like below using an XSLT file:

<?xml version="1.0" standalone="yes"?>
<ABCRelease>
  <ABC>
    <Doc_Id>1345</Doc_Id>
    <Vendor_Code>134500</Vendor_Code>
    <Property_Code>105559</Property_Code>
    <Invoice_Num>2034539</Invoice_Num>
  </ABC>
</ABCRelease>

My first time playing with XML and I have spent many hours not getting to far today and done a lot of searching on the topic. Is anyone able to help me out and provide some sample code that would enable this?

My problem has been in extracting the FieldName value and inserting it in the <> eg from:

<Field FieldName="Doc_ID">1</Field>

to

<Doc_Id>1345</Doc_Id>

Really would appreaciate your help.

Steven

  • 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-06T18:40:07+00:00Added an answer on June 6, 2026 at 6:40 pm

    This transformation:

    <xsl:stylesheet version="1.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     <xsl:output omit-xml-declaration="yes" indent="yes"/>
     <xsl:strip-space elements="*"/>
    
     <xsl:template match="Fields">
       <ABCRelease>
        <ABC>
          <xsl:apply-templates/>
        </ABC>
       </ABCRelease>
     </xsl:template>
    
     <xsl:template match="Field">
      <xsl:element name="{@FieldName}">
        <xsl:value-of select="."/>
      </xsl:element>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on the provided XML document:

    <Batch BatchID="896" BatchName="20120629.130504">
        <Document DocumentType="XML Question">
            <Fields>
                <Field FieldName="Doc_ID">1</Field>
                <Field FieldName="Vendor_Code">126400</Field>
                <Field FieldName="Property_Code">10519</Field>
                <Field FieldName="Invoice_Num">20509</Field>
            </Fields>
            <Files />
        </Document>
    </Batch>
    

    produces the wanted, correct result:

    <ABCRelease>
       <ABC>
          <Doc_ID>1</Doc_ID>
          <Vendor_Code>126400</Vendor_Code>
          <Property_Code>10519</Property_Code>
          <Invoice_Num>20509</Invoice_Num>
       </ABC>
    </ABCRelease>
    

    Explanation:

    Proper use of <xsl:element> and AVTs (Attribute Value Templates).

    • 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 looks like <?xml version='1.0' encoding='UTF-8'?> <root> <node name=foo1
I have this XML at http://localhost/file.xml : <?xml version=1.0 encoding=utf-8?> <val:Root xmlns:val=http://www.hw-group.com/XMLSchema/ste/values.xsd> <Agent> <Version>2.0.3</Version>
I have a simple XML file like so: <?xml version=1.0 encoding=UTF-8?> <foo attr=blah &#176;
I have an xml as <?xml version=1.0 encoding=UTF-8?> <Batch checksum=4f4e96dc724aa38965a75121b654a49830fc6a46f927f1b1803cdd22a40f1e27> <UpdateCache incremental=false cleanCache=true> <PayLoad>
have an xml file like this. <?xml version =1.0 encoding =utf-8?> <menu> <menuNode title=Register
I have an xml file which looks like this <?xml version=1.0 encoding=UTF-8 ?> <BulkDataExchangeRequests
I have a xml file which has the following header: <?xml version=1.1 encoding=UTF-8?> .
Here's an example of an XML file created in InfoPath: <?xml version=1.0 encoding=UTF-8?> <?mso-infoPathSolution
I have an xml like <?xml version='1.0' encoding='UTF-8'?> <feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearch/1.1/' xmlns:docs='http://schemas.google.com/docs/2007' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:gd='http://schemas.google.com/g/2005'
I am trying to transform an XML file into an updated version. I have

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.