Custom CQWP itemstyle with link to library
-
22-10-2019 - |
Pergunta
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:
- First ListItem
- Second ListItem
- Third ListItem
- Fourth ListItem
- Fifth ListItem
View all items <-- this being the link to the library
Is this possible?
Solução
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
Licenciado em: CC-BY-SA com atribuição
Não afiliado a sharepoint.stackexchange