Created
December 28, 2012 23:03
-
-
Save anonymous/4402884 to your computer and use it in GitHub Desktop.
xslt my
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsl:stylesheet | |
version="1.0" | |
exclude-result-prefixes="x d xsl msxsl cmswrt" | |
xmlns:x="http://www.w3.org/2001/XMLSchema" | |
xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" | |
xmlns:cmswrt="http://schemas.microsoft.com/WebParts/v3/Publishing/runtime" | |
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> | |
<xsl:output method="html" omit-xml-declaration="yes"/> | |
<xsl:param name="ItemsHaveStreams"> | |
<xsl:value-of select="'False'" /> | |
</xsl:param> | |
<xsl:variable name="OnClickTargetAttribute" select="string('javascript:this.target="_blank"')" /> | |
<xsl:variable name="ImageWidth" /> | |
<xsl:variable name="ImageHeight" /> | |
<xsl:template name="Default" match="*" mode="itemstyle"> | |
<xsl:variable name="SafeLinkUrl"> | |
<xsl:call-template name="OuterTemplate.GetSafeLink"> | |
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/> | |
</xsl:call-template> | |
</xsl:variable> | |
<xsl:variable name="SafeImageUrl"> | |
<xsl:call-template name="OuterTemplate.GetSafeStaticUrl"> | |
<xsl:with-param name="UrlColumnName" select="'ImageUrl'"/> | |
</xsl:call-template> | |
</xsl:variable> | |
<xsl:variable name="DisplayTitle"> | |
<xsl:call-template name="OuterTemplate.GetTitle"> | |
<xsl:with-param name="Title" select="@Title"/> | |
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/> | |
</xsl:call-template> | |
</xsl:variable> | |
<div class="item"> | |
<xsl:if test="string-length($SafeImageUrl) != 0"> | |
<div class="image-area-left"> | |
<a href="{$SafeLinkUrl}"> | |
<xsl:if test="$ItemsHaveStreams = 'True'"> | |
<xsl:attribute name="onclick"> | |
<xsl:value-of select="@OnClickForWebRendering"/> | |
</xsl:attribute> | |
</xsl:if> | |
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'"> | |
<xsl:attribute name="onclick"> | |
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/> | |
</xsl:attribute> | |
</xsl:if> | |
<img class="image" src="{$SafeImageUrl}" title="{@ImageUrlAltText}"> | |
<xsl:if test="$ImageWidth != ''"> | |
<xsl:attribute name="width"> | |
<xsl:value-of select="$ImageWidth" /> | |
</xsl:attribute> | |
</xsl:if> | |
<xsl:if test="$ImageHeight != ''"> | |
<xsl:attribute name="height"> | |
<xsl:value-of select="$ImageHeight" /> | |
</xsl:attribute> | |
</xsl:if> | |
</img> | |
</a> | |
</div> | |
</xsl:if> | |
<div class="link-item"> | |
<xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/> | |
<a href="{$SafeLinkUrl}" title="{@LinkToolTip}"> | |
<xsl:if test="$ItemsHaveStreams = 'True'"> | |
<xsl:attribute name="onclick"> | |
<xsl:value-of select="@OnClickForWebRendering"/> | |
</xsl:attribute> | |
</xsl:if> | |
<xsl:if test="$ItemsHaveStreams != 'True' and @OpenInNewWindow = 'True'"> | |
<xsl:attribute name="onclick"> | |
<xsl:value-of disable-output-escaping="yes" select="$OnClickTargetAttribute"/> | |
</xsl:attribute> | |
</xsl:if> | |
<xsl:value-of select="$DisplayTitle"/> | |
</a> | |
<div class="description"> | |
<xsl:value-of select="@Description" /> | |
</div> | |
</div> | |
</div> | |
</xsl:template> | |
<xsl:template name="News" match="Row[@Style='News']" mode="itemstyle"> | |
<xsl:param name="CurPos" /> | |
<xsl:param name="LastRow" /> | |
<xsl:variable name="SafeLinkUrl"> | |
<xsl:call-template name="OuterTemplate.GetSafeLink"> | |
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/> | |
</xsl:call-template> | |
</xsl:variable> | |
<xsl:variable name="SibSafeLinkUrl"> | |
<xsl:for-each select="following-sibling::*[1]"> | |
<xsl:call-template name="OuterTemplate.GetSafeLink"> | |
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/> | |
</xsl:call-template> | |
</xsl:for-each> | |
</xsl:variable> | |
<xsl:variable name="SafeImageUrl"> | |
<xsl:call-template name="OuterTemplate.GetSafeStaticUrl"> | |
<xsl:with-param name="UrlColumnName" select="'ImageUrl'"/> | |
</xsl:call-template> | |
</xsl:variable> | |
<xsl:variable name="DisplayTitle"> | |
<xsl:call-template name="OuterTemplate.GetTitle"> | |
<xsl:with-param name="Title" select="@Title"/> | |
<xsl:with-param name="UrlColumnName" select="'LinkUrl'"/> | |
</xsl:call-template> | |
</xsl:variable> | |
<xsl:variable name="LinkTarget"> | |
<xsl:if test="@OpenInNewWindow = 'True'" >_blank</xsl:if> | |
</xsl:variable> | |
<xsl:choose> | |
<xsl:when test="$CurPos mod 2 =1"> | |
<xsl:text disable-output-escaping="yes"><li style="width:610px; height:290px; "></xsl:text> | |
<div class="content-left" style="width:290px; height:290px;float:left;"> | |
<xsl:value-of select="@PublishingRollupImage" disable-output-escaping="yes" /> | |
<span class="NewsHeading"><h4><xsl:value-of select="$CurPos"/><xsl:value-of select="@Title"/></h4></span> | |
<span class="Desc" style="display:block; width:280px;"><xsl:value-of select="substring(@Comments,0,200)"/> | |
<xsl:if test="string-length(@Comments) > 200">…</xsl:if><a href="{$SafeLinkUrl}" class="ReadMore"> Read More</a></span> | |
</div> | |
<div class="content-right" style="float:right; width:290px; height:290px;"> | |
<xsl:if test="$CurPos != $LastRow "> | |
<xsl:value-of select="following-sibling::*[1]/@PublishingRollupImage" disable-output-escaping="yes" /> | |
<span class="NewsHeading"><h4><xsl:value-of select="$LastRow"/><xsl:value-of select="following-sibling::*[1]/@Title"/></h4></span> | |
<span class="Desc" style="display:block; width:280px;"><xsl:value-of select="substring(following-sibling::*[1]/@Comments,0,200)"/> | |
<xsl:if test="string-length(following-sibling::*[1]/@Comments) > 200">…</xsl:if> | |
<a href="{$SibSafeLinkUrl}" class="ReadMore"> Read More</a></span> | |
</xsl:if> | |
</div> | |
</xsl:when> | |
<xsl:otherwise> | |
<xsl:text disable-output-escaping="yes"></li></xsl:text> | |
</xsl:otherwise> | |
</xsl:choose> | |
<!--<div id="{concat('col-', $CurPos)}"> | |
<xsl:if test="string-length($SafeImageUrl) != 0"> | |
<div class="images-area-left"> | |
<a href="{$SafeLinkUrl}" target="{$LinkTarget}"> | |
<img class="image" src="{$SafeImageUrl}" alt="{@ImageUrlAltText}" /> | |
</a> | |
<div class="Heading-desc"> | |
<span class="NewsHeading"><h4><xsl:value-of select="@Title"/></h4></span> | |
<span class="Desc"> | |
<xsl:value-of select="substring(@Comments,0,200)"/> | |
<xsl:if test="string-length(@Comments) > 200">…</xsl:if> <a href="{$SafeLinkUrl}" class="ReadMore"> Read More</a> | |
</span> | |
</div> | |
</div> | |
</xsl:if> | |
</div>--> | |
</xsl:template> | |
</xsl:stylesheet> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment