Copied to clipboard

Flag this post as spam?

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


  • GLindqvist 13 posts 13 karma points
    Sep 20, 2010 @ 00:49
    GLindqvist
    0

    Problem with NewsList with the new schema 4.5.2

    Trying to get a newslist to work.

    - Startpage

    - NewsList

    - NewsItem1

    - NewsItem2

    ....

    What have I done wrong? It will only output <ul></ul> code via Macro.

    <?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"
      exclude-result-prefixes="msxml umbraco.library">

        <xsl:output method="xml" omit-xml-declaration="yes"/>
        <xsl:param name="currentPage"/>
        <xsl:variable name="noOfItems" select="8" />

        <xsl:template match="/">
            <ul>
              <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc]//NewsItem/node">
                    <xsl:sort select="newsDate" order="descending"/>
                    <xsl:if test="position()&lt;= $noOfItems">
                        <li>
          <span class="newsDate">
                            <xsl:value-of select="umbraco.library:FormatDateTime(newsDate, 'd MMMM ')"/></span>
                                      <href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
                        </li>
                    </xsl:if>              
                </xsl:for-each>
              
            </ul>
        </xsl:template>
    </xsl:stylesheet>
  • Chriztian Steinmeier 2798 posts 8788 karma points MVP 8x admin c-trib
    Sep 20, 2010 @ 09:02
    Chriztian Steinmeier
    0

    Hi GLindqvist,

    You just need to cut the "node" off of the select:

    <xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc]//NewsItem">

    /Chriztian 

  • GLindqvist 13 posts 13 karma points
    Sep 20, 2010 @ 09:16
    GLindqvist
    0

    Wow, it was so easy. Thanks Chriztian!

Please Sign in or register to post replies

Write your reply to:

Draft