xsl-list
[Top] [All Lists]

RE: XSLT Sort and choose last items problem

2003-02-10 08:20:56
Thanks Jeni for the previous solution, but I do have an additional
problem:

This is best explained with an example: if you go to this page you will
see that there is a "Previous" link but no "Next" link -
http://journal.the-i.org/?31.01.2003
If you go to this page you will see there is a "Next" link but no
"Previous" link - http://journal.the-i.org/?01.02.2003

This is because, once again, the days span across a month element.

This is a sample XML file:
<journal>
        <year>
                <month date="1">
                        <day date="1">
                                <contents/>
                        <day date="2">
                        ...
                </month>
                <month date="2">
                        <day date="1">
                                <contents/>
                        <day date="2">
                        ...
                </month>
                ...
        </year>
</journal>

The complete xsl file can be viewed at
http://journal.the-i.org/xsl/day.xsl or the appropriate snippet for the
"Previous" link, (where $day is the numeric (xs:gDay) @date attribute of
the current day):

<xsl:if test="../day[(_at_)date=$day -1]">
        <a href="?{../day[(_at_)date=$day
-1]/@date}.{../@date}.{../../@date}" title="View the previous journal
entry">
                <xsl:text>Previous</xsl:text>
        </a>
</xsl:if>

This works for day elements within the same month, but doesn't work for
the first or last day of a month.

Sincerely,

Ned Martin
http://nedmartin.org/


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