Subject: RE: [xsl] processing xml question From: "Falls, Travis D (CASD, IT)" <Travis.Falls@xxxxxxxxxxxxxxx> Date: Mon, 9 Dec 2002 12:41:06 -0500 |
Sorry, I tried not to forget any detail. The content has the two dates pubdate and expdate both in the format of YYYY-mm-dd hh:mm:ss example: 2002-12-25 01:23:45 I store a string that I get from the server with my java program which is in the same format and it is nowString. This so if the publish date is after the nowString it isn't publishable yet, or the expiration date is before the nowString then this survey is expired. Falls, Travis D (CASD, IT) wrote: > I have an xml file that I read in. It has several (potentially 365) item > nodes. The Item node looks as follows: > > <item> > <id>1038918508813</id> > <title></title> > <surveycode>CSEE_iConnect_Channel_Survey_2002-12-03 > 14:05:51</surveycode> <link>/HIG/Survey/1038918508811.html</link> > <pubdate>2002-12-11 00:00:00</pubdate> > <expdate>2002-12-12 00:00:00</expdate> > <archdate></archdate> > </item> > > The programming task is to get the most recently published item that isn't > expired and the previous one this one if there is one. How do you determine that it expired? Is it just when pubdate >= expdate? Or is it when the trailing part of surveycode (2002-12-03) is >= substring-before(expdate,' ')? Or do you have the current date somewhere (like in an externally-supplied parameter) that you compare to expdate? > I want to do this differently, by building a document fragment of items and > putting them in order newest to oldest. Then I can just render the first > item in the new document fragment that meets the pubdate and expdate > condition, and the one after that is the previous one. I don't know how to > take a document fragment and make it a document though, or if I have too. You don't need to. A clever XPath expression and XSLT keys would identify the items you want from the set of all items that haven't expired. I'd offer some code but you haven't clarified what determines when something is expired. Mike -- Mike J. Brown | http://skew.org/~mike/resume/ Denver, CO, USA | http://skew.org/xml/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list This communication, including attachments, is for the exclusive use of addressee and may contain proprietary, confidential or privileged information. If you are not the intended recipient, any use, copying, disclosure, dissemination or distribution is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return email and delete this communication and destroy all copies. XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] processing xml question, Mike Brown | Thread | Re: [xsl] processing xml question, Mike Brown |
Re: [xsl] processing xml question, Mike Brown | Date | [xsl] The 2.0 collision course (was, Mike Brown |
Month |