rss.xslt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2011
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <!-- This stylesheet defines global portal variables and templates. -->
  13. <xsl:stylesheet version="1.0"
  14. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  15. xmlns:out="dummy-uri"
  16. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. xmlns:rss="http://developer.cognos.com/schemas/xts/rss/"
  19. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  20. exclude-result-prefixes="xsl xtsext xts rss cm">
  21. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  22. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  23. <!--
  24. This stylesheet (rss.xslt) consists of the following templates:
  25. rss:variables
  26. rss:link
  27. rss:button
  28. -->
  29. <!--
  30. Template - rss:variables:
  31. -->
  32. <xsl:template match="rss:variables">
  33. <out:variable name="abs-gateway">
  34. <out:choose>
  35. <out:when test="starts-with($gateway, 'http://') or starts-with($gateway, 'https://')">
  36. <out:value-of select="$gateway"/>
  37. </out:when>
  38. <out:otherwise>
  39. <out:value-of select="/root/configProps/param[@name='cps']/property[@name='gateway']"/>
  40. </out:otherwise>
  41. </out:choose>
  42. </out:variable>
  43. <out:variable name="rss-url">
  44. <out:value-of select="$abs-gateway"/>
  45. <out:for-each select="/root/env/param[@name != 'backURL' and @name != 'errURL' and @name != 'encoding' and (text() or @name = 'search')]">
  46. <out:choose>
  47. <out:when test="position() = 1">?</out:when>
  48. <out:otherwise>&amp;</out:otherwise>
  49. </out:choose>
  50. <out:value-of select="@name"/>=<out:value-of select="xtsext:protect(xtsext:urlencode(string(.)),'url', concat('NAME',@name),'getdata')"/>
  51. </out:for-each>
  52. <out:text/>&amp;feed=rss<out:text/>
  53. </out:variable>
  54. </xsl:template>
  55. <!-- generate a <link> element for Live Bookmark support in Firefox -->
  56. <xsl:template match="rss:link">
  57. <link rel="alternate" type="application/rss+xml" href="{'{$rss-url}'}">
  58. <out:attribute name="title"><xts:string id="IDS_PORTAL"/></out:attribute>
  59. </link>
  60. </xsl:template>
  61. <!-- generate the RSS button a link to the rss version of the page -->
  62. <xsl:template match="rss:button">
  63. <out:if test="key('system-param', 'hide-rss-feed-links') != 'true'">
  64. <div id="rss-button" style="position: relative; margin-right: 5px; width:100%">
  65. <a href="{'{$rss-url}'}" type="application/rss+xml">
  66. <img id="rss-image" src="{'{$image_root}'}icon_rss_32x15.gif" border="0" align="right" style="margin-right: 5px">
  67. <out:attribute name="title"><xts:string id="IDS_RSS_FEED_AVAILABLE"/></out:attribute>
  68. </img>
  69. </a>
  70. </div>
  71. </out:if>
  72. </xsl:template>
  73. <xsl:template match="*">
  74. <xsl:copy>
  75. <xsl:copy-of select="@*"/>
  76. <xsl:apply-templates/>
  77. </xsl:copy>
  78. </xsl:template>
  79. </xsl:stylesheet>