Subject: Re: [xsl] Release Date vs. Highlight Until Date From: "xsl-list" <xsl-list@xxxxxxxx> Date: Mon, 20 Sep 2004 20:36:38 -0400 |
Thanks for your suggestions. I am not sure the CMS vendor supports XSL 2.0. After looking more at the system I think I'll implement an XSL extension to retrieve sysdate instead of passing it everywhere I need it. I've been digging deeper and found that the dates are stored as yyyyMMddTHHmmss, which I don't think is xs:datetime format but should be pretty easy to parse/sort, or convert to another format for parsing/sorting. Therefore, since a single XML document contains both the IA and the content, I think I can do something like (half code, half psuedo-code): <xsl:variable name="sysdate" select="me:function" /> Is it possible to write a single XPath query that merges the equivalent of the two XPath queries below (excuse my attempt at syntax) such that an xsl:for-each with that as select will first process the elements matching the first condition, then those matching the second condition? //item[@highlight_date < $sysdate] //item Also, to ensure I don't get the same record twice, do I just reverse the first condition in the second condition? Something like: //item[@highlight_date < $sysdate] //item[@highlight_date >= $sysdate] I think that for performance I wouldn't want this combined query to return more than 5 records. It seems like this would have to do with position(), but that can only apply before the sort, and I want the 5 records after sort. Any suggestions? maybe a recursive function? anyway, I have to consider alternatives for performance. Then within the xsl:for-each I need to sort such that those records matched by the highlight_date query appear first - any suggestions there? Now you can can all see how lost I am. Thanks again, -John On Mon, 20 Sep 2004 21:08:26 -0300, Jan Limpens wrote > john, > > xslt version 1 does not support type checking, everything is more or > less just text. so doing date parsing is kind of tedious, still > possible (depending on how complex the check is). you probably could > pass the current date as a parameter to the xsltransformer and let > the stylesheet do the checking using regular expression and alike. > or, if the date is stored in the xs:datetime format, an alphabetic > sort will do, then you will need to select only the first 5 > elements. (if it4s based on novelty) > > maybe you will think about letting .net decide weather a xml file > qualifies for the main page or not and pass the result (the n > selected filenames) as a parameter to the xslt file, which then just > 'dumbly' transforms. > > another possibility is to use a xslt 2.0 transformer (saxon) but the > .net implementation is still very at its beginning and IMHO the .net > transformer is currently more user friendly and stable. > > just my 55 > > -- > jan > > On Mon, 20 Sep 2004 19:15:18 -0400, xsl-list <xsl-list@xxxxxxxx> wrote: > > Hi, > > > > I am new to the list and XSL in general, so I apologize if this is the wrong > > forum for this question. I am also simplifying my problem as much as > > possible. I am also still at a pretty high level, looking more into the > > concepts than the code. While I would appreciate code examples, simple > > suggestions of what tokens I should research or URLs with further information > > would also be appreciated. I am working with a CMS that stores both the > > information architecture (like a directory structure) and content (like XML > > files inside the directories) as XML which is transformed using XSL to HTML > > for distribution to browsers. If what I'm trying to do becomes too > > complicated for XML I can use pure .NET code, but I'm wondering what XSL > > solutions might be possible. > > > > Each news record has a "release date" value. I am not sure of the format but > > hopefully my code could handle multiple formats, or if there is a standard for > > date formatting in XML maybe the CMS uses that. On a main page I need to list > > the latest 5 article titles based on this "release date", with links to the > > article content. That would seem like a simple sort with some kind of break > > condition after 5 loops (though I'm not even sure how to do that), but the > > complication is that each record also has a "highlight until" date; if the > > current system date is before the "highlight until" date, those highlighted > > records need to appear at the top of the list, which should still be > > constrained to 5 articles. > > > > It seems that XSL doesn't inherently know what date it is, so either my CMS > > vendor should already be passing that or I need to figure out how to pass this > > as a parameter to my XSL. I'm also not finding many web references to this > > specific kind of date logic. Based on these I'm wondering if a .NET component > > is the right way to go, but since the data is already in XML I think I would > > prefer XSL if possible/not too complicated. > > > > Any assistance would be greatly appreciated. > > > > Thanks, > > > > -John
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Release Date vs. Highligh, Jan Limpens | Thread | Re: [xsl] Release Date vs. Highligh, Robert Koberg |
Re: [xsl] Release Date vs. Highligh, Robert Koberg | Date | Re: [xsl] Release Date vs. Highligh, Robert Koberg |
Month |