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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:48:16+00:00 2026-05-24T05:48:16+00:00

I have the following xml and I need to sort this xml using XSLT

  • 0
I have the following xml and I need to sort this xml using XSLT based on the value of 
the "CONTENT_LENGTH" KEY ie. based on the attributes in the element <DOC_DETAIL     
KEY="CONTENT_LENGTH" VALUE="14"/>

<?xml version="1.0" encoding="UTF-8"?>
<DOC_LISTS>
<DOC_LIST>
<DOC_URL>testurl4</DOC_URL>
<DOC_DETAILS>
<DOC_DETAIL KEY="TITLE" VALUE="Red Dragon"/>
<DOC_DETAIL KEY="LANGUAGE" VALUE="english"/>
<DOC_DETAIL KEY="CONTENT_LENGTH" VALUE="14"/>
</DOC_DETAILS>
</DOC_LIST>
<DOC_LIST>
<DOC_URL>testurl2</DOC_URL>
<DOC_DETAILS>
<DOC_DETAIL KEY="TITLE" VALUE="Hannibal Rising"/>
<DOC_DETAIL KEY="LANGUAGE" VALUE="english"/>
<DOC_DETAIL KEY="CONTENT_LENGTH" VALUE="7"/>
</DOC_DETAILS>
</DOC_LIST>
</DOC_LISTS>

What will be the sort select statement in <xsl:sort select=""/>?
  • 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-24T05:48:17+00:00Added an answer on May 24, 2026 at 5:48 am

    You will want DOC_DETAILS/DOC_DETAIL[@KEY='CONTENT_LENGTH']/@VALUE

    Full simple example using Identity template

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"     xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
    <xsl:output method="xml" indent="yes"/>
    
    <xsl:template match="//DOC_LISTS">
      <xsl:for-each select="DOC_LIST">
        <xsl:sort select="DOC_DETAILS/DOC_DETAIL[@KEY='CONTENT_LENGTH']/@VALUE" data-type="number"/>
        <xsl:copy>
          <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
      </xsl:for-each>
    </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 need to have following attribute value in my XML node: CommandLine=copy $(TargetPath) ..\..\&#x0D;&#x0A;echo
I have the following XML: <InterSection criteria=Microsoft-ASP>value</Intersection> <InterSection criteria=Microsoft-MVC>value</Intersection> <InterSection criteria=HP-MVC>value</Intersection> I need to
I have a simple xml document that looks like the following snippet. I need
I have the following xml <Values> <New> <value>110</value> <date>2009-10-15</date> </New> <Previous> <value>100</value> <date>2010-10-15</date> </Previous>
I have the following XML I need to parse. Much of my issue seems
I have a following XML structure that I need to transform: <recordset rowCount=68 fieldNames=ITEM,ECL,LEAD_TIME
I have the following xml input: <data> <parent Id=1 value=ParentOne> <child x=1 y=2 />
I have the following xml that I need to deserialise to an object: <animals>
Suppose I have the following xml, what xsl do I need to transform the
I have the following xml: <product> <name>beef</name> <category>food</category> <unknownfield1>..</unknownfield1> <unknownfield2>..</unknownfield2> </product> I need 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.