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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:54:18+00:00 2026-05-26T04:54:18+00:00

Is it possible to sort the following xml with xsl (sort SubGroup in Group

  • 0

Is it possible to sort the following xml with xsl (sort SubGroup in Group by date in mm/dd/yyyy format):

<Data version="2.0">
   <Group>
        <SubGroup>          
            <Date>11/14/2011</Date>
        </SubGroup>
        <SubGroup>          
            <Date>10/25/2011</Date>
        </SubGroup>
   </Group>
   <Group>
        <SubGroup>
            <Date>01/14/2008</Date>
        </SubGroup>
        <SubGroup>          
            <Date>11/01/2005</Date>
        </SubGroup>
   </Group>
</Data>

to this one:

<Data version="2.0">
   <Group>
        <SubGroup>
            <Date>10/25/2011</Date>
        </SubGroup>
        <SubGroup>          
            <Date>11/14/2011</Date>
        </SubGroup>
   </Group>
   <Group>
        <SubGroup>
            <Date>11/01/2005</Date>
        </SubGroup>
        <SubGroup>          
            <Date>01/14/2008</Date>
        </SubGroup>
   </Group>
</Data>

As I think there are two tasks: 1) sorting SubGroups by values in inner node 2) Sorting by date in special format. Please post an answer if you know how to solve the (1) problem for sorting by integer values instead of date.

  • 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-26T04:54:18+00:00Added an answer on May 26, 2026 at 4:54 am
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="xml" indent="yes"/>
    
      <xsl:template match="Group">
        <xsl:copy>
          <xsl:apply-templates select="SubGroup">
            <xsl:sort select="concat(
                      substring(Date, 7, 4),
                      substring(Date, 1, 2),
                      substring(Date, 4, 2)
                      )"/>
          </xsl:apply-templates>
        </xsl:copy>
      </xsl:template>
    
      <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
      </xsl:template>
    
    </xsl:stylesheet>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been trying to work out whether it's possible to do the following sort
How is it possible to sort data from multiple tables by relevance? My table
If possible, how can I improve the following quick sort(performance wise). Any suggestions? void
I am wondering whether XSLT makes it possible to sort an XML file if
Suppose I have the following xml template: <?xml version=1.0 encoding=UTF-8 ?> <myXML> <params> <param
Is it possible to applying some sort of onClick event on the XML nodes?
I have the following xsl stylesheet: <xsl:stylesheet xmlns=http://www.w3.org/1999/xhtml xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=xml encoding=utf-8/> <xsl:template match=/>
Hi I have the following xml <?xml version=1.0 encoding=UTF-8?> <root> <item> <name>john</name> <year>2010</year> </item>
I have the following xml file <ScheduleProvider id=257 scheduleDate=2008-03-20T15:34:18Z xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=my.xsd> <Content action=insert duration=7200
I have read Sort NSArray using sortedArrayUsingFunction and it's possible that the following question

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.