OZONE Asylum
Forums
XML - XSL - XSLT - XHTML - CSS - DOM
Xml sorting with Xsl
This page's ID:
21558
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
I know nothing about C# yet sorting with XSLT is simple, however it is quite slow. XSL(T) is almost a programming language in itself. You use an XSL style sheet to "process" an XML file. The XSL file can match data in an XML file using X-Path, which is an XML related expression language (X-Path is used within the XSL file). Sorting in XSLT is done using the <xsl:for-each> element to match all the children/attributes/whatever and you can specify a sort element inside this to order the results of the for-each. www.w3schools.com has some good tutorials on this. Although, if you're wanting to do this often throughout the execution of a program, invoking an XSLT processor is going to be rather slow. If *all* you want to do is sort some data, then using XSLT is probably going to be overkill. You might be better off writing some sort of custom sorting method. I'm not sure what a data grid is (googled it and got a hodge podge of different ASP & .NET crap), but it sounds like some kind of abstract data type like a hash map or a tree, if that's the case then you should be able to implement a simple quick sort algorithm which will be much faster then using XSLT. Chances are someone has already written one for t already, but again, I know nothing about C#, this data-grid thing or the avaliable community support for the language, so I'm just stabing in the dark here. But again, using XSLT just for sorting a bit fo XML data sounds like overkill, but you're likely to find many other uses for XSLT so I'd encourage you to have a look into it anyhow.
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »