Skip to content

Instantly share code, notes, and snippets.

@spdustin
spdustin / basic dvwp.xsl
Created October 29, 2012 19:57
Baseline DVWP
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- 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="/">
<!-- This is the actual wrapper element that will be emitted -->
<div>
@spdustin
spdustin / xslt-character-replace.xsl
Created October 29, 2012 21:05
XSL with character replacement
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- 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="/">
<!-- This is the actual wrapper element that will be emitted -->
<div>
@spdustin
spdustin / xslt-choose-when-otherwise.xsl
Created October 29, 2012 21:11
XSL Snippet - If/then/else (choose/when/otherwise)
<xsl:choose>
<xsl:when test="@PercentComplete = '0 %'">
Not started
</xsl:when>
<xsl:when test="@PercentComplete = '100 %'">
Completed
</xsl:when>
<xsl:otherwise>
In process - Current status is <xsl:value-of select="@status"/>
</xsl:otherwise>
@spdustin
spdustin / xslt-entities-tricks.xsl
Created October 29, 2012 21:30
XSL for entities demo
<!DOCTYPE xsl:stylesheet [ <!ENTITY theTitle "@Title"> <!ENTITY copytext "Copyright (c) 2012 SharePoint Experts"> ]>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- 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="/">
<!-- This is the actual wrapper element that will be emitted -->
@spdustin
spdustin / identitytransform.xsl
Created October 30, 2012 16:35
XSL Identity Transform
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xmp>
<xsl:apply-templates />
</xmp>
</xsl:template>
<xsl:template match="@*|node()">
@spdustin
spdustin / featuredContent.css
Created October 30, 2012 20:06
Featured Content CSS
#sliderList li {
display: block;
width: 400px;
height: 200px;
margin: 0;
padding: 0;
position: absolute;
left: -400px;
top: 0;
opacity: 0;
@spdustin
spdustin / svg-example.xsl
Created October 30, 2012 21:47
XSL to create SVG
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- This XSL Stylesheet created by SharePoint Experts, Inc. -->
<!-- http://sharepointexperience.com -->
<xsl:output indent="yes" method="xml"/>
<!-- This template is the "wrapper" or "container" for the custom view. -->
<xsl:template match="/">
<!-- This is the actual wrapper element that will be emitted -->
<svg height="420px" width="{(count(/dsQueryResponse/Rows/Row)+2)*55}px" xmlns="http://www.w3.org/2000/svg">
<g id="bar" transform="translate(0,420)">
<!-- This will tell the data view to look for the actual content
@spdustin
spdustin / spe.bodyClassHelper.js
Created October 31, 2012 15:15
WIP - Decorate the Body
var bodyClass =
"site"
+ _spPageContextInfo.siteServerRelativeUrl.replace(/\W/g, "-");
bodyClass +=
" web"
+ _spPageContextInfo.webServerRelativeUrl.replace(/\W/g, "-");
document.body.className += " " + bodyClass;
@spdustin
spdustin / spe.helpers.js
Created October 31, 2012 16:25
WIP - SPE Util Singleton
var SPE = {
DesignHelpers: {
Classes: {
site: "site" + _spPageContextInfo.siteServerRelativeUrl.replace(/\W/g, "-"),
web: "web" +_spPageContextInfo.webServerRelativeUrl.replace(/\W/g, "-"),
pagestate: "page-state-" + (SP.Ribbon.PageState.Handlers.isInEditMode() == false) ? "view" : "edit"
}
}
};
@spdustin
spdustin / tmp-getuserinfo.js
Created October 31, 2012 16:44
Temp - Get Current User Info
function getUserInfo() {
var ctx = new SP.ClientContext.get_current();
var web = ctx.get_web();
this.usr = web.get_currentUser();
ctx.load(this.usr);
ctx.executeQueryAsync(
Function.createDelegate(this, this.getUserInfo_success),