[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: processing xml question
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|