Guest User

xsl

a guest
Jul 22nd, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.90 KB | None | 0 0
  1. <xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema" version="1.0" exclude-result-prefixes="xsl ddwrt msxsl x d" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:atom2="http://purl.org/atom/ns#">
  2. <xsl:param name="rss_FeedLimit">8</xsl:param>
  3. <xsl:param name="rss_ExpandFeed">false</xsl:param>
  4. <xsl:param name="rss_LCID">1033</xsl:param>
  5. <xsl:param name="rss_WebPartID">RSS_Viewer_WebPart</xsl:param>
  6. <xsl:param name="rss_alignValue">left</xsl:param>
  7. <xsl:param name="rss_IsDesignMode">True</xsl:param>
  8. <xsl:output method="html" indent="no" />
  9. <xsl:template match="rss">
  10. <xsl:call-template name="RSSMainTemplate" /></xsl:template>
  11. <xsl:template name="RSSMainTemplate" 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">
  12. <xsl:variable name="Rows" select="channel/item" />
  13. <xsl:variable name="RowCount" select="count($Rows)" />
  14. <div class="slm-layout-main">
  15. <xsl:call-template name="RSSMainTemplate.body">
  16. <xsl:with-param name="Rows" select="$Rows" />
  17. <xsl:with-param name="RowCount" select="count($Rows)" /></xsl:call-template>
  18. </div>
  19. </xsl:template>
  20. <xsl:template name="RSSMainTemplate.body" 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">
  21. <xsl:param name="Rows" />
  22. <xsl:param name="RowCount" />
  23. <xsl:for-each select="$Rows">
  24. <xsl:variable name="CurPosition" select="position()" />
  25. <xsl:variable name="RssFeedLink" select="$rss_WebPartID" />
  26. <xsl:variable name="CurrentElement" select="concat($RssFeedLink,$CurPosition)" />
  27. <xsl:call-template name="RSSDescTransform1">
  28. <xsl:with-param name="DescriptionField" select="description" /></xsl:call-template>
  29. </xsl:for-each>
  30. </xsl:template>
  31. <xsl:template name="RSSDescTransform1" 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">
  32. <xsl:param name="DescriptionField" />
  33. <xsl:variable name="itemTitle" select="title" />
  34. <xsl:variable name="itemAuthor" select="substring-before(substring-after($DescriptionField, 'itemAuthor:&lt;/b&gt; '),'&lt;/div&gt;')" />
  35. <xsl:variable name="itemPubDate" select="substring-before(substring-after($DescriptionField, 'itemPubDate:&lt;/b&gt; '),'&lt;/div&gt;')" />
  36. <xsl:variable name="itemDescription" select="substring-before(substring-after($DescriptionField, 'itemDescription:&lt;/b&gt; '),'&lt;/div&gt;')" />
  37. <xsl:variable name="itemHTML" select="substring-after($DescriptionField, 'itemHTML:&lt;/b&gt; ')" />
  38. <xsl:variable name="itemLink" select="substring-before(substring-after($DescriptionField, 'href=&quot;'),'&quot;')" />
  39. <xsl:call-template name="RSSDescTransform2">
  40. <xsl:with-param name="itemTitle" select="$itemTitle" />
  41. <xsl:with-param name="itemAuthor" select="$itemAuthor" />
  42. <xsl:with-param name="itemPubDate" select="$itemPubDate" />
  43. <xsl:with-param name="itemDescription" select="$itemDescription" />
  44. <xsl:with-param name="itemLink" select="$itemLink" />
  45. <xsl:with-param name="itemHTML" select="$itemHTML" /></xsl:call-template>
  46. </xsl:template>
  47. <xsl:template name="RSSDescTransform2" 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">
  48. <xsl:param name="itemTitle" />
  49. <xsl:param name="itemAuthor" />
  50. <xsl:param name="itemPubDate" />
  51. <xsl:param name="itemDescription" />
  52. <xsl:param name="itemLink" />
  53. <xsl:param name="itemHTML" />
  54. <xsl:choose>
  55. <xsl:when test="$itemAuthor='Twitter'">
  56. <div class="social-post-twitter industry-item">
  57. <!--<a href="{$itemLink}" target="_blank">-->
  58. <xsl:value-of select="$itemHTML" disable-output-escaping="yes" />
  59. <!--</a>-->
  60. </div>
  61. <div class="industry-text" style="padding-left:36px">
  62. <xsl:value-of select="ddwrt:FormatDateTime(string($itemPubDate), number($rss_LCID), 'MMMM dd, yyyy')" />
  63. </div>
  64. </xsl:when>
  65. <xsl:when test="$itemAuthor='Facebook'">
  66. <div class="social-post-facebook industry-item"> <a href="{$itemLink}" target="_blank">
  67. <xsl:value-of select="$itemTitle"/>
  68. </a>
  69.  
  70. </div>
  71. <div class="industry-text" style="padding-left:36px">
  72. <xsl:value-of select="ddwrt:FormatDateTime(string($itemPubDate), number($rss_LCID), 'MMMM dd, yyyy')" />
  73. </div>
  74. </xsl:when>
  75. <xsl:when test="$itemAuthor='Youtube'">
  76. <div class="social-post-youtube industry-item"> <a href="{$itemLink}" target="_blank">
  77. <xsl:value-of select="$itemTitle"/>
  78. </a>
  79.  
  80. </div>
  81. <div class="industry-text" style="padding-left:36px">
  82. <xsl:value-of select="ddwrt:FormatDateTime(string($itemPubDate), number($rss_LCID), 'MMMM dd, yyyy')" />
  83. </div>
  84. </xsl:when>
  85. <xsl:when test="$itemAuthor='Flickr'">
  86. <div class="social-post-flickr industry-item"> <a href="{$itemLink}" target="_blank">
  87. <xsl:value-of select="$itemTitle"/>
  88. </a>
  89. </div>
  90. <div class="industry-text" style="padding-left:36px">
  91. <xsl:value-of select="ddwrt:FormatDateTime(string($itemPubDate), number($rss_LCID), 'MMMM dd, yyyy')" />
  92. </div>
  93. </xsl:when>
  94. <xsl:when test="$itemAuthor='OSQAR'">
  95. <div class="social-post-osqar industry-item"> <a href="{$itemLink}" target="_blank">
  96. <xsl:value-of select="$itemTitle"/>
  97. </a>
  98.  
  99. </div>
  100. <div class="industry-text" style="padding-left:36px">
  101. <xsl:value-of select="ddwrt:FormatDateTime(string($itemPubDate), number($rss_LCID), 'MMMM dd, yyyy')" />
  102. </div>
  103. </xsl:when>
  104. <xsl:when test="$itemAuthor='PumpTalk'">
  105. <div class="social-post-pumptalk industry-item"> <a href="{$itemLink}" target="_blank">
  106. <xsl:value-of select="$itemTitle"/>
  107. </a>
  108.  
  109. </div>
  110. <div class="industry-text" style="padding-left:36px">
  111. <xsl:value-of select="ddwrt:FormatDateTime(string($itemPubDate), number($rss_LCID), 'MMMM dd, yyyy')" />
  112. </div>
  113. </xsl:when>
  114. </xsl:choose>
  115. </xsl:template>
  116. </xsl:stylesheet>
Advertisement
Add Comment
Please, Sign In to add comment