Skip to content

Instantly share code, notes, and snippets.

@spdustin
Created July 8, 2015 21:12
Show Gist options
  • Save spdustin/07dafc75ccb0012fb3f3 to your computer and use it in GitHub Desktop.
Save spdustin/07dafc75ccb0012fb3f3 to your computer and use it in GitHub Desktop.
Accordion Announcements
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="WPQ"/>
<xsl:param name="ListTitle"/>
<!-- This XSL Stylesheet created by SharePoint Experts, Inc. -->
<!-- http://sharepointexperience.com -->
<xsl:output method="html" indent="yes"/>
<!-- This template is the "wrapper" or "container" for the custom view. -->
<xsl:template match="/">
<h1><xsl:value-of select="$ListTitle"/></h1>
<!-- This is the actual wrapper element that will be emitted -->
<div id="accordion{$WPQ}">
<!-- This will tell the data view to look for the actual content
and come back when it's done. -->
<xsl:apply-templates/>
</div>
<script type="text/javascript">
$('#accordion<xsl:value-of select="$WPQ"/>').accordion();
function removeWPClick<xsl:value-of select="$WPQ"/>() {
document.getElementById('MSOZoneCell_WebPart<xsl:value-of select="$WPQ"/>').removeAttribute('onmouseup').removeAttribute('onkeyup');
};
_spBodyOnLoadFunctionNames.push('removeWPClick<xsl:value-of select="$WPQ"/>');
</script>
<!-- end wrapper -->
</xsl:template>
<xsl:template match="/dsQueryResponse/Rows/Row">
<!-- This markup is used for each item in the list -->
<h3>
<xsl:value-of select="@Title"/>
</h3>
<div>
<xsl:value-of select="@Body" disable-output-escaping="yes"/>
</div>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment