|
Home > Archive > IIS ASP > June 2004 > order by date in XmlDom
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
order by date in XmlDom
|
|
| Eduardo Rosa 2004-06-30, 6:01 pm |
| Hi, I need some help...
I have a field type date in xml, loading with Microsoft.XMLDOM, how can I
order by date?
thanks a lot
xml code:
<Root>
<Fields>
<Field Id="456955" Date="01/05/1956" />
<Field Id="159753" Date="21/06/1972" />
<Field Id="769513" Date="14/07/1932" />
</Fields>
</Root>
| |
| Bob Barrows [MVP] 2004-06-30, 6:01 pm |
| Eduardo Rosa wrote:
> Hi, I need some help...
> I have a field type date in xml, loading with Microsoft.XMLDOM, how
> can I order by date?
>
> thanks a lot
>
> xml code:
> <Root>
> <Fields>
> <Field Id="456955" Date="01/05/1956" />
> <Field Id="159753" Date="21/06/1972" />
> <Field Id="769513" Date="14/07/1932" />
> </Fields>
> </Root>
Your best solution would be to load them initially in the proper order (I
assume they are coming from a database, so simply use an ORDER BY clause in
the query used to retrieve these results.)
If that is not possible for some reason, then you will get the fastest
results from an xsl transformation, which is outside of the scope of this
newsgroup. I suggest you post to an xml or xsl newsgroup.
Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
| |
| Martin Honnen 2004-06-30, 6:01 pm |
|
Eduardo Rosa wrote:
> I have a field type date in xml, loading with Microsoft.XMLDOM, how can I
> order by date?
> xml code:
> <Root>
> <Fields>
> <Field Id="456955" Date="01/05/1956" />
> <Field Id="159753" Date="21/06/1972" />
> <Field Id="769513" Date="14/07/1932" />
Consider using a format like yyyy-mm-dd then you can use string
comparison. Otherwise you need to extract the year, month, day and
compare, perhaps by recomposing to the format given. How you do that
depends on the tools you want to use, with XSLT/XPath you can sort.
--
Martin Honnen
http://JavaScript.FAQTs.com/
|
|
|
|
|