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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T14:49:28+00:00 2026-05-11T14:49:28+00:00

I need to transform a lot of XML files (Fedora export) into a different

  • 0

I need to transform a lot of XML files (Fedora export) into a different kind of XML. Trying to do it with XSL stylesheets and checking with the msxsl transformer.

Supposedly I have xml file like this (assuming there are actually other nodes inside AAA, OBJ, amd all other nodes), Source.XML:

<DOC> <AAA>     <STUFF>example</STUFF>     <OBJ>         <OBJVERS id='A1' CREATED='2008-02-18T13:28:08.245Z'/>         <OBJVERS id='A2' CREATED='2008-02-19T10:42:41.965Z'/>         <OBJVERS id='A13' CREATED='2009-03-16T12:43:11.703Z'/>     </OBJ> </AAA> <FFF/> <GGG/> <DDD>     <FILE /> </DDD> </DOC> 

Which I need to look something like this (Target.XML):

    <MYOBJ>       <ELEM>contents of OBJVERS with the biggest id OR  creation date (whichever is easier to do) go here</ELEM>       <IMAGE> contents of <FILE> node go here</IMAGE>     </MYOBJ> 

The main problem that I have is that since I am new to XSL (and for this particular task do not have enough time to learn it properly) is that I can’t understand how to tell XSL processor not to process anything else, I keep getting output from , for example.

Update: basically, I solved this problem meanwhile. I will post my own answer and close the question.

Update2: OK, Andrew’s answer works, too, so I am just accepting it. 🙂

  • 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. 2026-05-11T14:49:29+00:00Added an answer on May 11, 2026 at 2:49 pm

    This question has been formulated very loosely and this is not helpful for providing a more meaningful solution.

    This said, the below transformation:

    <xsl:stylesheet version='1.0'  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>  <xsl:output omit-xml-declaration='yes' indent='yes'/>      <xsl:template match='/'>       <MYOBJ>         <ELEM>            <xsl:for-each select='/*/AAA/OBJ/OBJVERS'>              <xsl:sort select='@CREATED' order='descending'/>               <xsl:if test='position() = 1'>                 <xsl:copy-of select='.'/>              </xsl:if>            </xsl:for-each>         </ELEM>          <IMAGE>           <xsl:copy-of select='/*/DDD/FILE'/>         </IMAGE>       </MYOBJ>     </xsl:template> </xsl:stylesheet> 

    when applied on the artificial and contrived provided XML document (that in fact has bad structuring and naming and goes against many principles of designing XML documents):

    <DOC>     <AAA>         <STUFF>example</STUFF>         <OBJ>             <OBJVERS id='A1' CREATED='2008-02-18T13:28:08.245Z'/>             <OBJVERS id='A2' CREATED='2008-02-19T10:42:41.965Z'/>             <OBJVERS id='A13' CREATED='2009-03-16T12:43:11.703Z'/>         </OBJ>     </AAA>     <FFF/>     <GGG/>     <DDD>         <FILE />     </DDD> </DOC> 

    produces what one could guess is the wanted result:

    <MYOBJ>    <ELEM>       <OBJVERS id='A13' CREATED='2009-03-16T12:43:11.703Z'/>    </ELEM>    <IMAGE>       <FILE/>    </IMAGE> </MYOBJ> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to transform an Oracle SQL statement into a Stored Procedure therefore users
We have pretty big (~200mb) xml files from different sources that we want to
I need to transfer DVD image files between a Windows XP computer and a
I need to serialize/de-serialize some objects into/from string and transfer them as just opaque
I have a bunch of files that I need to be able to transport
I'm trying to write parallel tests in soapui and need to transfer properties between
I need to parse the following node: <media:keywords>keyword1,keyword2<![CDATA[keyword3]]></media:keywords> into a valid string, preferably keyword1,keyword2,keyword3
I have a collection containing a LOT of Data Transfer Objects that I need
In my app I need to download a lot of images for data in
I need to transfer a database from a SQL Server instance test server to

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.