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>");
}
--------------------------------------------------------------------------------------------------------------------------------