Subject: Re: [xsl] Release Date vs. Highlight Until Date From: Robert Koberg <rob@xxxxxxxxxx> Date: Mon, 20 Sep 2004 17:56:01 -0700 |
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.
<xsl:template match="items"> <xsl:apply-template select="item"> <xsl:sort select="@release-date"/> </xsl:apply-templates> </xsl:template>
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]
//itemYou would want to apply-templates like I have shown above then you can check the position of the node (continuing on my XSL above):
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]
<xsl:template match="item"> <xsl:if test="position() < 6"> <xsl:apply-templates/> </xsl:if> </xsl:template>
<>
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.
best, -Rob
<> Thanks again,
-John
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Release Date vs. Highligh, xsl-list | Thread | [xsl] Release Date vs. Highlight Un, john-xsl-list |
Re: [xsl] Release Date vs. Highligh, Robert Koberg | Date | Re: [xsl] Release Date vs. Highligh, M. David Peterson |
Month |