[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Re: Date Parsing (Was: Document() question)

Subject: RE: Re: Date Parsing (Was: Document() question)
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Wed, 12 Jun 2002 10:10:12 +0100
xpath numbers less than 10
It's not at all clear from your posting where your problems lie. It
doesn't sound like a difficult problem, so there must be some simple
point that you have missed. Perhaps if you show us your stylesheet we
will be able to tell you where you are going wrong.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 

> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> Jarkko.Moilanen@xxxxxx
> Sent: 12 June 2002 08:04
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Re: Date Parsing (Was: Document() question)
> 
> 
> 
> This is not what I ment. I ment that I need to read the 
> latest/newest values 
> from a different xml- file. To be more exact: while processing 
> 000000001001.xml I need the values mentioned before from file 
> TopicIndex.xml.
> 
> But thanks for the sorting, which I am familiar already =)
> 
> Jarkko
> 
> Lainaus Peter Davis <pdavis152@xxxxxxxxx>:
> 
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > On Tuesday 11 June 2002 22:33, Jarkko.Moilanen@xxxxxx wrote:
> > > I need to find the latest document from file TopicIndex.xml and 
> > > insert
> > the
> > > values to 000000001001.xml file. Values that I need are: 
> SignStatus, 
> > > DocType, Time, Sender, Subject. The result is shown in 
> html format.
> > 
> > So the hard part is really just finding the "latest" <Information> 
> > element. Fortunately, you're date and time formats are easily 
> > parseable, and more importantly, the parts of the date and time (1) 
> > begin with the most significant digits, and (2) are padded with 0's 
> > for numbers less than 10.
> > Those qualities mean that you can use <xsl:sort> to sort 
> the date and
> > time
> > alphabetically, and then select the latest one from the sorted list.
> > 
> > Once you sort the list of <Information> elements, you have 
> to choose 
> > the last one from the list.  The easiest way to do that is with the 
> > position() and
> > last() functions, which will let you test the position of each
> > <Information> 
> > element in the sorted list.  Finally, once you get the desired
> > <Information> 
> > element, you just copy the necessary child elements to the 
> result tree.
> > 
> > <xsl:template match="Document">
> >   <Result>
> >     <xsl:apply-templates select="Information">
> >       <!-- this stage is simple because your date and time 
> formats are 
> > already
> >         sortable; other formats might require additional 
> processing, 
> > since
> >         XPath does not have a build in date parser/sorter -->
> >       <xsl:sort select="Time"/>
> >       <!-- sort by Time (date) first, and then by the clock if two 
> > dates are
> >         the same -->
> >       <xsl:sort select="Clock"/>
> >     </xsl:apply-templates>
> >   </Result>
> > </xsl:template>
> > 
> > <xsl:template match="Information">
> >   <!-- if the current element is the last element in the 
> sorted list -->
> >   <xsl:if test="position() = last()">
> >     <xsl:copy-of select="SignStatus"/>
> >     <xsl:copy-of select="DocType"/>
> >     <xsl:copy-of select="Time"/>
> >     <xsl:copy-of select="Sender"/>
> >     <xsl:copy-of select="Subject"/>
> >   </xsl:if>
> > </xsl:template>
> > 
> > HTH
> > 
> > - --
> > Peter Davis
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.0.7 (GNU/Linux)
> > 
> > iD8DBQE9BvEqNSZCJx7tYycRAkVRAKCzbd8iuy1XyLDspP5azvyUTUg8fgCdGJGB
> > m1MKktmxDH86UycTCk2hnpk=
> > =PPzz
> > -----END PGP SIGNATURE-----
> > 
> > 
> 
> 
> 
> ******************************************************************
> Jarkko Moilanen         *You are wise, witty, and wonderful,     *
> Researcher/ ITCM        *but you spend too much time             *
> jm60697@xxxxxx          *reading this sort of trash.             *
> www.uta.fi/~jm60697     *                                        *
> GSM: +358 50 3766 927   *                                        *
> ******************************************************************
> * ITCM | Information Technology and Crisis Management            *
> * http://www.itcm.org                                            *
> ******************************************************************
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.