Skip to content

Instantly share code, notes, and snippets.

@sionjlewis
Created June 24, 2015 14:20
Show Gist options
  • Save sionjlewis/14dc81f730c7df49b0c7 to your computer and use it in GitHub Desktop.
Save sionjlewis/14dc81f730c7df49b0c7 to your computer and use it in GitHub Desktop.
Client-side Development Techniques with CQWP(s) and JavaScript - Part 2/5
<xsl:stylesheet
version="1.0"
exclude-result-prefixes="x xsl cmswrt cbq"
xmlns:x="http://www.w3.org/2001/XMLSchema"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:cmswrt="http://schemas.microsoft.com/WebPart/v3/Publishing/runtime"
xmlns:cbq="urn:schemas-microsoft-com:ContentByQueryWebPart">
<xsl:output method="html" indent="no" media-type="text/html" omit-xml-declaration="yes"/>
<xsl:param name="cbq_isgrouping" />
<xsl:param name="cbq_columnwidth" />
<xsl:param name="Group" />
<xsl:param name="GroupType" />
<xsl:param name="cbq_iseditmode" />
<xsl:param name="cbq_viewemptytext" />
<xsl:param name="cbq_errortext" />
<xsl:param name="SiteId" />
<xsl:param name="WebUrl" />
<xsl:param name="PageId" />
<xsl:param name="WebPartId" />
<xsl:param name="FeedPageUrl" />
<xsl:param name="FeedEnabled" />
<xsl:param name="SiteUrl" />
<xsl:param name="BlankTitle" />
<xsl:param name="BlankGroup" />
<xsl:param name="UseCopyUtil" />
<xsl:param name="DataColumnTypes" />
<xsl:param name="ClientId" />
<xsl:param name="Source" />
<xsl:param name="RootSiteRef" />
<xsl:param name="CBQPageUrl" />
<xsl:param name="CBQPageUrlQueryStringForFilters" />
<xsl:variable name="BeginList" select="string('&lt;ul class=&quot;dfwp-list&quot;&gt;')" />
<xsl:variable name="EndList" select="string('&lt;/ul&gt;')" />
<xsl:variable name="BeginListItem" select="string('&lt;li class=&quot;dfwp-item&quot;&gt;')" />
<xsl:variable name="EndListItem" select="string('&lt;/li&gt;')" />
<xsl:template match="/">
<script type="text/javascript" src="/MySiteCollction/Style Library/Branding/HTML/MyWebPart/_temp.js"></script>
<div id="relationshipEditor">
<!-- Inject content here... -->
</div>
<script type="text/javascript">
var pr = SJLewis.ProductRelationships;
<xsl:call-template name="populateArray" />
</script>
</xsl:template>
<xsl:template name="populateArray">
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row" />
<xsl:for-each select="$Rows">pr.productRelationships.push(new pr.productRelationship(<xsl:value-of select="@ID" />, <xsl:value-of select="@Product1" />, <xsl:value-of select="@Product2" />));</xsl:for-each>
pr.doSomeStuff();
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment