473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Xml.XPath How to sort by mor then one

What I'm Trying to do is sort By Date. I came up whith the idea of
splite the date in year, month and day then sort them individualy.
this work perfect in xsl
<xsl:sort order ="descending" select="substring-
after(substring-after(fechaInicio,'/'),'/')" />
<xsl:sort order ="descending" select="substring-
before(fechaInicio,'/')" />
<xsl:sort order ="descending" select="substring-
before(substring-after(fechaInicio,'/'),'/')" />
This came up whith the perfect result. But i want to do it with the
Xml.XPath

This is what I have done so far
-------------------------------------------------------------------------------------------------------------------------------
XPathDocument doc = new
XPathDocument(Server.MapPath("calendario.xml"));
XPathNavigator nav = doc.CreateNavigator();

//Select all books by Jane Austen.
XPathExpression expr;
expr = nav.Compile("calendario/actividad/fechaInicio");

--------- //Sort the selected books by title. This is jus sort the
firs line of the code nothing else.
---------------------------

expr.AddSort("substring-after(substring-
after(fechaInicio,'/'),'/')", XmlSortOrder.Descending,
XmlCaseOrder.None, "", XmlDataType.Number);
//expr.AddSort("substring-before(fechaInicio,'/')",
XmlSortOrder.Descending, XmlCaseOrder.None, "", XmlDataType.Number);
//expr.AddSort("substring-before(substring-
after(fechaInicio,'/'),'/')", XmlSortOrder.Descending,
XmlCaseOrder.None, "", XmlDataType.Number);

-------------------------------------------------------
//Display the selection.
XPathNodeIterator iterator = nav.Select(expr);
while (iterator.MoveNext())
{

XPathNavigator nav2 = iterator.Current.Clone();
nav2.MoveToFirstChild();
dateData = nav2.Value

Response.Write("News title: " + nav2.Value);
Response.Write("<br>");
}
--------------------------------------------------------------------------------------------------------------------------------

Feb 14 '07 #1
0 1897

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: DN | last post by:
I'd like to pass multiple attributes to XPath AddSort like: expr = nav.Compile(strQuery); expr.AddSort(sortArray, XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Text); But I get...
5
by: laks | last post by:
Hi I have the following xsl stmt. <xsl:for-each select="JOB_POSTINGS/JOB_POSTING \"> <xsl:sort select="JOB_TITLE" order="ascending"/> This works fine when I use it. But when using multiple...
5
by: David Thielen | last post by:
Hi; I set up my xml as follows: XmlDocument xml = new XmlDocument(); xml.Load(File.Open("data.xml", FileMode.Open, FileAccess.Read)); XmlNamespaceManager context = new...
1
by: DN | last post by:
I'd like to pass multiple attributes to XPath AddSort like: expr = nav.Compile(strQuery); expr.AddSort(sortArray, XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Text); But I get...
1
by: Loretta | last post by:
Given an XML node List with the individual nodes looking like the following, what kind of XPATH statement can I use to sort the nodes by element F8 and inside F8 by element F3? ...
0
by: Sabba | last post by:
TESTRESULTS PRE STUDENT @sID=1 @Score=5 STUDENT @sID=2 @Score=2 STUDENT @sID=3
14
by: Mat| | last post by:
Hello :-) I am learning XPath, and I am trying to get child nodes of a node whose names do *not* match a given string, e.g : <dummy> <example> <title>Example 1</title> <body>this is an...
0
by: Chazam | last post by:
What I'm Trying to do is sort By Date. I came up whith the idea of splite the date in year, month and day then sort them individualy. this work perfect in xsl <xsl:sort order ="descending"...
4
by: Claudio Calboni | last post by:
Hello folks, I'm having some performance issues with the client-side part of my application. Basically, it renders a huge HTML table (about 20'000 cells in my testing scenario), without content....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.