Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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 " ">]><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()<= $noOfItems"> <li> <span class="newsDate"> <xsl:value-of select="umbraco.library:FormatDateTime(newsDate, 'd MMMM ')"/></span> <a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a> </li> </xsl:if> </xsl:for-each> </ul> </xsl:template></xsl:stylesheet>
Hi GLindqvist,
You just need to cut the "node" off of the select:
<xsl:for-each select="$currentPage/ancestor-or-self::*[@isDoc]//NewsItem">
/Chriztian
Wow, it was so easy. Thanks Chriztian!
is working on a reply...
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.
Continue discussion
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 " ">
]>
<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()<= $noOfItems">
<li>
<span class="newsDate">
<xsl:value-of select="umbraco.library:FormatDateTime(newsDate, 'd MMMM ')"/></span>
<a href="{umbraco.library:NiceUrl(@id)}"><xsl:value-of select="@nodeName"/></a>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</xsl:template>
</xsl:stylesheet>
Hi GLindqvist,
You just need to cut the "node" off of the select:
/Chriztian
Wow, it was so easy. Thanks Chriztian!
is working on a reply...
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.