Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Connie DeCinko 931 posts 1159 karma points
    May 03, 2011 @ 21:21
    Connie DeCinko
    0

    How to get children of parent

    I have a news home page with an archive page and date folders beneath.  I cannot seem to get the date folder contents for the archive page which is at the same level.  Should I move my date folders under my archive page?  I'd rather not have to hard code a starting node ID.

    Currently:

    Home
    - - News
    - - - -  News Archives
    - - - -  2011
    - - - - - -   12
    - - - - - -   11
    - - - - - -   10
    - - - -   2010
    - - - - - -   12
    - - - - - -   11

     

  • Eran Meir 401 posts 543 karma points
    May 03, 2011 @ 21:40
    Eran Meir
    0

    you can by $currentPage/../Archive//NewsItems

  • Connie DeCinko 931 posts 1159 karma points
    May 04, 2011 @ 00:36
    Connie DeCinko
    0

    Not working.

  • Connie DeCinko 931 posts 1159 karma points
    May 04, 2011 @ 00:44
    Connie DeCinko
    0

    I'm trying to group by year and month the content nodes that are in a sibling node.  This gives me no results.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
      exclude-result-prefixes="msxml  umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes  Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings  Exslt.ExsltSets PS.XSLTsearch ">

    <xsl:output method="html" omit-xml-declaration="yes"/>

    <xsl:param name="currentPage"/>
    <xsl:key name="years" match="* [@isDoc]" use="umbraco.library:FormatDateTime(@updateDate, 'yyyy')"/>
    <xsl:key name="months" match="* [@isDoc]" use="umbraco.library:FormatDateTime(@updateDate, 'yyyy-MM')"/>

    <xsl:template match="/">
    <ul> <!-- Iterate over all nodes with a year-id similar to the first in every group -->
      <xsl:for-each select="$currentPage/parent::* [@isDoc] [(generate-id() = generate-id(key('years', Exslt.ExsltDatesAndTimes:year(@updateDate))[1]))]">
        <xsl:sort select="@updateDate" order="descending" />
        <li> <xsl:value-of select="Exslt.ExsltDatesAndTimes:year(@updateDate)" />
        <ul>
          <xsl:variable name="months" select="key('years', Exslt.ExsltDatesAndTimes:year(@updateDate))" />
          <!-- Iterate over all nodes with a month-id similar to the first in every group -->
          <xsl:for-each select="$months[generate-id() = generate-id(key('months',umbraco.library:FormatDateTime(@updateDate, 'yyyy-MM'))[1])]">
            <xsl:sort select="@updateDate" order="ascending" />
            <li> <xsl:value-of select="umbraco.library:FormatDateTime(@updateDate, 'MM')"/>
              <ul> <!-- Iterate over all nodes in a group, i.e. with the same months-key -->
                <xsl:for-each select="key('months',umbraco.library:FormatDateTime(@updateDate, 'yyyy-MM'))">
                  <xsl:sort select="@updateDate" order="ascending" />
                  <li> <xsl:value-of select="umbraco.library:LongDate(@updateDate)"/> : <xsl:value-of select="@nodeName" /> </li>
                </xsl:for-each>
              </ul>
            </li>
          </xsl:for-each>
        </ul>
        </li>
      </xsl:for-each>
    </ul>
    </xsl:template>
    </xsl:stylesheet>
  • Eran Meir 401 posts 543 karma points
    May 04, 2011 @ 06:22
    Eran Meir
    0

    why you won't work with the datefolders? it's already grouped for you.

  • Connie DeCinko 931 posts 1159 karma points
    May 04, 2011 @ 16:46
    Connie DeCinko
    0

    I'm using auto folders, and yes, in the backend things are grouped.  But the output is not grouped.  I am trying to output the contents of the auto folders.

     

  • Connie DeCinko 931 posts 1159 karma points
    May 16, 2011 @ 19:58
    Connie DeCinko
    0

    Solved.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies