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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:03:54+00:00 2026-05-10T19:03:54+00:00

I was using an XSL style sheet to do the sorting but it seems

  • 0

I was using an XSL style sheet to do the sorting but it seems to be very slow. Is there a more efficient way?

It is a flat list of nodes, if I convert the nodes to an object and sort in a GenericList would it help?

EDIT I don’t need the end result to be XML.

  • 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-10T19:03:54+00:00Added an answer on May 10, 2026 at 7:03 pm

    Do it with xsl using an XslCompiledTransform, but make sure you cache the XslCompiledTransform because the compilation is slow, execution is extremely fast.

    So:

    1. Write an xsl that matches your xml, sorts them and had the sorted list as output
    2. Get the XslCompiledTransform holding that xsl from cache, and if it doesn’t exist, create it and insert into cache
    3. Transform your xml through your xsl into a new XmlDocument

    This is bloody fast, keeps your code clean and you’re flexible when it comes to changing the sort implementation; it’s just editing a single xsl.

    I type this without checking it so there may be typo’s but this is how you should go about:

    XslCompiledTransform xsl = (XslCompiledTransform)HttpRuntime.Cache.Get('my_xsl'); if (xsl == null) {   string fileName = 'path/to/your/xslfile.xsl';   xsl = new XslCompiledTransform();   xsl.Load(fileName);     HttpRuntime.Cache.Insert('my_xsl', xsl, new CacheDependency(new string[]{fileName})); } 

    And to transform use a method somewhere like this:

    public static XmlNode TransformToXml(IXPathNavigable xml, XslCompiledTransform xsl, XsltArgumentList arguments, XmlWriterSettings settings) {   XmlDocument output = new XmlDocument();   using (XmlWriter writer = XmlWriter.Create(output.CreateNavigator().AppendChild()))   {     xsl.Transform(xml, arguments, writer);   }   return output; } 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 231k
  • Answers 231k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Aral Balkan's article linked in zdmytriv's answer is good reading… May 13, 2026 at 2:09 am
  • Editorial Team
    Editorial Team added an answer Yes, it does. Clicking the same column multiple times in… May 13, 2026 at 2:09 am
  • Editorial Team
    Editorial Team added an answer Change a bit the pattern to hard-code the final zero:… May 13, 2026 at 2:09 am

Related Questions

I am putting an XSL together than will create a NAnt build script using
Using xslt/xpath, I need to be able to select the two elements which have
I was over at the StarCraft2 website and decided to take a look at
I've a need to display certain XML content in tabular form (XSL-FO for pdf

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.