1

I was wondering if it is possible to somehow create a new itemstyle which has a link to the library where the items in the content query is located?

Example:

  1. First ListItem
  2. Second ListItem
  3. Third ListItem
  4. Fourth ListItem
  5. Fifth ListItem

View all items <-- this being the link to the library

Is this possible?

3

Just add the anchor tag with a dynamic link to the bottom of your itemstyle xsl and then wrap it with an xsl:if statement to check the position to see if the last list item is last.

<xsl:if test="position() =last()">
   <a href="link.aspx">View all items</a>
</xsl:if>

If you want to make the href dynamic, find a source for the link in your XML somewhere and use:

<a href="{@source}">View all items</a>

You may have to use XSL to remove formatting after a certain character to achieve the path to the libary from another link

2
  • It doesn't work - position() is always the same (1) for all returned items. I put the snippet in the end of my ItemStyle.xsl template.
    – tarjeieo
    Dec 6 '11 at 10:56
  • 1
    Had to use this method to get it to work blog.mastykarz.nl/…
    – tarjeieo
    Dec 6 '11 at 12:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy