Which i got help with and the code worked perfectly. The biggest, and only problem with it now is limiting the number of nodes shown. Problem is, i cant get it to work properly. The thing is i dont know how xsl:templates work so i dont know where and how to limit the number of items. I once got it working, but it looked like it limited the number of document types and not the number of listed items.
For good measure here is the code again:
<xsl:template match="/"> <ul class="list"> <!-- Process ALL descendants of $currentPage --> <xsl:apply-templates select="$currentPage/descendant::*[@isDoc][not(umbracoNaviHide = 1)]"> <xsl:sort select="articleDate[normalize-space()]" order="descending" /> <xsl:sort select="@updateDate[not(normalize-space(../articleDate))]" order="descending" /> </xsl:apply-templates> </ul> </xsl:template>
<!-- Template for specific DocumentTypes --> <xsl:template match="ArtikelStudier
| ArtikelStudiejob | Eksamen | ArtikelLegatsoegning | ArtikelUdIVerden |
ArtikelOekonomi | ArtikelVelvre | ArtikelTop5"> <li> <a href="{umbraco.library:NiceUrl(@id)}"> <!-- Take first image (if any) --> <xsl:apply-templates select="outputPictures[1]" /> <!-- Article heading and teaser text--> <h5><xsl:value-of select="articleHeading"/></h5> <p class="teaser"><xsl:value-of select="umbraco.library:TruncateString(artikel-Teasertekst,70,'...')"/></p> </a> </li> </xsl:template>
This is one of the edge cases where you have to use the for-each instruction instead of apply-templates - but you can keep your templates if you do it like this:
Limiting a list of document types to a specific number
Ok, this is either tricky or stupidly simple.
It started in this thread: http://our.umbraco.org/forum/developers/xslt/23108-List-of-all-documents-from-all-descendant-pages
Which i got help with and the code worked perfectly. The biggest, and only problem with it now is limiting the number of nodes shown. Problem is, i cant get it to work properly. The thing is i dont know how xsl:templates work so i dont know where and how to limit the number of items. I once got it working, but it looked like it limited the number of document types and not the number of listed items.
For good measure here is the code again:
That is the code right now, and this is how i think it would work:
But that obviously doesnt work with where the if statement is.
So, hopefully you guys understand my predicament, and hopefully the solution is simple enough. Thank you for your time.
Hi Frederik,
This is one of the edge cases where you have to use the for-each instruction instead of apply-templates - but you can keep your templates if you do it like this:
Perfect! Thank you for the quick reply and thank you for the solution! There was a tiny typing mistake in your code but that was an easy fix ;)
Here is the fixed and final snippet for future use if anyone has the same problem:
Ah yes - I edited that 4 times because the forum insisted on keeping it all on one line :-)
(I've corrected it now, so it looks like I'm flawless :-)
/Chriztian
ah ok, yeah the forum only works when it wants to :p
is working on a reply...