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

Related Questions

I have an XSL style sheet for which I need to add some custom
I am trying to get some xpath from xsl variable using xsl ver 1.0
we're currently generating all our official documents using XSL-FO transformation using .xml files as
I have the following xsl template that I'm using to group my xsl. The
How do you add a page break into a document with XSL-FO? I'm using
Using online interfaces to a version control system is a nice way to have
Using ASP.NET MVC there are situations (such as form submission) that may require a
I would like to change database column names of a BDC list webpart using
I am trying to sort an xml using xsl. Got some sample from xml.com.
Using XSL I am trying to turn this XML: <book><title>This is a <b>great</b> book</title></book>

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.