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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:35:09+00:00 2026-05-20T05:35:09+00:00

Hello i have this XML and i want to sort all the MESSAGE/DATA/TRANSACTIONS/TRANSACTION With

  • 0

Hello i have this XML and i want to sort all the MESSAGE/DATA/TRANSACTIONS/TRANSACTION With XSLT by “POSTED-DATE” and return the sorted XML to work with.

i have hours reading about XSL and trying to do that but it doesnt work.

thanks in advance

  <DATA RESULT="TRUE">
      <ACCOUNT NUMBER="MyNumber" CURRENCY="MyCurrency" TYPE="MyType" /> 
      <TRANSACTIONS>
          <TRANSACTION DESCRIPTION="DESC 1" CURRENCY="USD" POSTED-DATE="2010/01/31" AMOUNT="240.88" /> 
          <TRANSACTION DESCRIPTION="DESC 3" CURRENCY="USD" POSTED-DATE="2010/05/20" AMOUNT="240.88" /> 
          <TRANSACTION DESCRIPTION="DESC 8" CURRENCY="USD" POSTED-DATE="2008/12/31" AMOUNT="240.88" /> 
          <TRANSACTION DESCRIPTION="DESC 3" CURRENCY="USD" POSTED-DATE="2003/12/31" AMOUNT="240.88" /> 
          <TRANSACTION DESCRIPTION="DESC 99" CURRENCY="USD" POSTED-DATE="2011/01/01" AMOUNT="240.88" /> 
          <TRANSACTION DESCRIPTION="DESC 999" CURRENCY="USD" POSTED-DATE="2011/01/06" AMOUNT="240.88" /> 
      </TRANSACTIONS>
  </DATA>

Thanks in advance

  • 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-20T05:35:09+00:00Added an answer on May 20, 2026 at 5:35 am

    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="node()|@*">
      <xsl:copy>
       <xsl:apply-templates select="node()|@*"/>
      </xsl:copy>
     </xsl:template>
    
     <xsl:template match="TRANSACTIONS">
      <TRANSACTIONS>
       <xsl:apply-templates>
        <xsl:sort select="@POSTED-DATE"/>
       </xsl:apply-templates>
      </TRANSACTIONS>
     </xsl:template>
    </xsl:stylesheet>
    

    when applied on the provided XML document:

    <DATA RESULT="TRUE">
        <ACCOUNT NUMBER="MyNumber" CURRENCY="MyCurrency" TYPE="MyType" />
        <TRANSACTIONS>
            <TRANSACTION DESCRIPTION="DESC 1"
            CURRENCY="USD"
            POSTED-DATE="2010/01/31" AMOUNT="240.88" />
            <TRANSACTION DESCRIPTION="DESC 3"
            CURRENCY="USD"
            POSTED-DATE="2010/05/20" AMOUNT="240.88" />
            <TRANSACTION DESCRIPTION="DESC 8"
            CURRENCY="USD"
            POSTED-DATE="2008/12/31" AMOUNT="240.88" />
            <TRANSACTION DESCRIPTION="DESC 3"
            CURRENCY="USD"
            POSTED-DATE="2003/12/31" AMOUNT="240.88" />
            <TRANSACTION DESCRIPTION="DESC 99"
            CURRENCY="USD"
            POSTED-DATE="2011/01/01" AMOUNT="240.88" />
            <TRANSACTION DESCRIPTION="DESC 999"
            CURRENCY="USD"
            POSTED-DATE="2011/01/06" AMOUNT="240.88" />
        </TRANSACTIONS>
    </DATA>
    

    produces the wanted, correct result:

    <DATA RESULT="TRUE">
       <ACCOUNT NUMBER="MyNumber" CURRENCY="MyCurrency" TYPE="MyType"/>
       <TRANSACTIONS>
          <TRANSACTION DESCRIPTION="DESC 3"
          CURRENCY="USD"
          POSTED-DATE="2003/12/31" AMOUNT="240.88"/>
          <TRANSACTION DESCRIPTION="DESC 8"
          CURRENCY="USD"
          POSTED-DATE="2008/12/31" AMOUNT="240.88"/>
          <TRANSACTION DESCRIPTION="DESC 1"
          CURRENCY="USD"
          POSTED-DATE="2010/01/31" AMOUNT="240.88"/>
          <TRANSACTION DESCRIPTION="DESC 3"
          CURRENCY="USD"
          POSTED-DATE="2010/05/20" AMOUNT="240.88"/>
          <TRANSACTION DESCRIPTION="DESC 99"
          CURRENCY="USD"
          POSTED-DATE="2011/01/01" AMOUNT="240.88"/>
          <TRANSACTION DESCRIPTION="DESC 999"
          CURRENCY="USD"
          POSTED-DATE="2011/01/06" AMOUNT="240.88"/>
       </TRANSACTIONS>
    </DATA>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello all I'm using NSXMLParser to parse some xml data. I'm using this data
If I have some xml like this: <mynode> <mysubnode> <mysubsubnode>hello world</mysubsubnode> some more text
hello I have this code that use to sort a datatable. Dim sortingIndex As
Hello I currently have this code checking if a cookie exists, it works all
Supose I have this string: a= hello world hella warld and I want to
So I have some XML like this: <bar> <foo>Something</foo> <baz> <foo>Hello</foo> <zap>Another</zap> <baz> <bar>
Let's assume I have a simple XML file: <data> <text>Hello world!&lt;br&gt;Nice to see you
In Ruby I could have this: string=<<EOTEMPLATE <root> <hello> <to>%s</to> <message>welcome mr %s</message> </hello>
i have a xml like this I want to parse the xml, build a
I have this XML File: <?xml version="1.0" encoding="UTF-8"?> <karteikasten> <vokabel stufe="1"> <eng> <item>Hi</item> <item>Hello</item>

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.