The Umbraco xslt files includes the Exslt libraries, so you could try something along these lines. (This haven't been tested, so there might be some syntactical errors). This is assuming the pages you're trying to list is subpages to the current page, one or more levels below.
Sort By Day Of Week?
Hi,
I have a datepicker property on a set of pages. I would like to be able to list them on a page under each day of week that they apply to. For example:
Does someone have a snippet that I could use for this logic?
Monday
Page 1
Page 2
Page 3
Tuesday
Page 4
Page 5
Page 6
Wednesday
Page 7
Page 8
Page 9
Thursday
...
Thanks!
--Kent
The Umbraco xslt files includes the Exslt libraries, so you could try something along these lines. (This haven't been tested, so there might be some syntactical errors). This is assuming the pages you're trying to list is subpages to the current page, one or more levels below.
Regards
Jesper Hauge
Hi Kent,
Here's my take, using what I like to call a "Helper Variable" - a chunk of custom XML that's used as kind of a proxy for the actual transformation:
<?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:umb="urn:umbraco.library" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:date="urn:Exslt.ExsltDatesAndTimes" exclude-result-prefixes="umb date msxml" > <xsl:output method="xml" indent="yes" omit-xml-declaration="yes" /> <xsl:param name="currentPage" /> <!-- Create an XML helper variable --> <xsl:variable name="weekdays"> <day name="Monday" id="2" /> <day name="Tueday" id="3" /> <day name="Wednesday" id="4" /> <day name="Thursday" id="5" /> <day name="Friday" id="6" /> <day name="Saturday" id="7" /> <day name="Sunday" id="1" /> </xsl:variable> <xsl:template match="/"> <xsl:apply-templates select="msxml:node-set($weekdays)/day" /> </xsl:template> <!-- Actual output for each page --> <xsl:template match="node"> <li> <xsl:value-of select="@nodeName" /> </li> </xsl:template> <!-- Template for a <day> element in the $weekdays variable --> <xsl:template match="day"> <xsl:variable name="days" select="$currentPage/node[date:dayinweek(data[@alias = 'dateProperty']) = current()/@id]" /> <h2><xsl:value-of select="@name" /></h2> <xsl:if test="$days"> <ul> <xsl:apply-templates select="$days" /> </ul> </xsl:if> </xsl:template> </xsl:stylesheet>
/Chriztian
Thanks for the responses Jesper and Chriztian! I chose Chriztian's first and it worked great.
--Kent
is working on a reply...