On 5/16/07, Vaduvoiu Tiberiu <vaduvoiutibi(_at_)yahoo(_dot_)com> wrote:
fileX.xml:
<document>
<date>20071805101800</date>(yyyymmddhhmmss)
<url>folderX/foldery/</url>
<other tags that aren't to interest>
</document>
I know the shorter solution would be to have a date attribute to the <list> xml file like <file
date="2007...">file1.xml</file>
But it's a little more complicated than that, I can't really put the data as an
attribute so I need to do it with the xml-s structured like that.
Try something like this (BTW your example is not correct -- there is
no 18th month):
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/*">
<xsl:copy>
<xsl:for-each select="file">
<xsl:sort select="substring(document(.)/*/date,1,4)"
data-type="number"/>
<xsl:sort select="substring(document(.)/*/date,5,2)"
data-type="number"/>
<xsl:sort select="substring(document(.)/*/date,7)"
data-type="number"/>
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
10x. Cheers
----- Original Message ----
From: Dimitre Novatchev <dnovatchev(_at_)gmail(_dot_)com>
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Sent: Wednesday, May 16, 2007 2:42:58 PM
Subject: Re: [xsl] complicated sort problem
On 5/16/07, Vaduvoiu Tiberiu <vaduvoiutibi(_at_)yahoo(_dot_)com> wrote:
> Similar problem with the one I had yesterday:
> I need to sort the following xml:
>
> <list>
> <file>file1.xml</file>
> <file>file2.xml</file>
> ......
> <file>file100.xml</file>
> </list>
>
> each of these files have some tags (2 of which are:)
> <date>20071805101800</date>(yyyymmddhhmmss)
> <url>folderX/foldery/</url>
>
> So I need to sort the first xml by the date (which is in each fileX.xml). Is
that possible? .
The short answer is: Yes.
A more specific solution with code could be produced, once the structure of the
file<N>.xml
files is known.
--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
You've achieved success in your field when you don't know whether what
you're doing is work or play
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
____________________________________________________________________________________Boardwalk
for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's
economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--