agsCmHelper.xsl 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2008
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:agsh="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:doc="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/doc/" xmlns:out="dummy-uri" xmlns:xtscm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="doc">
  9. <xsl:output method="html" encoding="UTF-8" indent="no"/>
  10. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  11. <doc:group prefix="agsad">
  12. <doc:location>
  13. <doc:namespace>http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/agsCmHelper/</doc:namespace>
  14. <doc:ref>ps/ags/logicsheets/agsCmHelper.xsl</doc:ref>
  15. </doc:location>
  16. </doc:group>
  17. <!-- +++++++++++++++++++++++
  18. creates the relevent cmPreProcess tags for a url
  19. +++++++++++++++++++++++++++++-->
  20. <doc:template type="interpret">
  21. <doc:name>rssTaskObject</doc:name>
  22. <doc:desc>This tag creates outputs tags to pass to cmpreprocess that will create the xml to create an rssTask in cm from the env params passed in with the agent task</doc:desc>
  23. <doc:notes/>
  24. </doc:template>
  25. <xsl:template match="agsh:storeIDConverter">
  26. <out:template name="storeIDConverter">
  27. <out:param name="storeID"/>
  28. <out:choose>
  29. <out:when test="contains($storeID, 'storeID(') or $storeID=''">
  30. <out:value-of select="$storeID"/>
  31. </out:when>
  32. <out:otherwise>
  33. <out:text>storeID("</out:text>
  34. <out:value-of select="$storeID"/>
  35. <out:text>")</out:text>
  36. </out:otherwise>
  37. </out:choose>
  38. </out:template>
  39. </xsl:template>
  40. <!-- +++++++++++++++++++++++
  41. creates the relevent cmPreProcess tags for a url
  42. +++++++++++++++++++++++++++++-->
  43. <doc:template type="interpret">
  44. <doc:name>rssTaskObject</doc:name>
  45. <doc:desc>This tag creates outputs tags to pass to cmpreprocess that will create the xml to create an rssTask in cm from the env params passed in with the agent task</doc:desc>
  46. <doc:notes/>
  47. </doc:template>
  48. <xsl:template match="agsh:rssTaskObject">
  49. <out:template name="rssTaskObject">
  50. <out:param name="task"/>
  51. <out:param name="path"/>
  52. <out:param name="name"/>
  53. <out:choose>
  54. <!--making a shortcut -->
  55. <out:when test="$task/param[@name='url_uri'] = 'url_entry'">
  56. <xtscm:shortcutRSSTask>
  57. <xtscm:searchPath>
  58. <out:value-of select="$path"/>
  59. </xtscm:searchPath>
  60. <out:call-template name="rssTaskObjectCommon">
  61. <out:with-param name="name" select="$name"/>
  62. <out:with-param name="task" select="$task"/>
  63. </out:call-template>
  64. <xtscm:link>
  65. <xtscm:baseClass>
  66. <xtscm:searchPath>
  67. <out:value-of select="$task/param[@name='url_entry']"/>
  68. </xtscm:searchPath>
  69. </xtscm:baseClass>
  70. </xtscm:link>
  71. </xtscm:shortcutRSSTask>
  72. </out:when>
  73. <!--making a url -->
  74. <out:when test="$task/param[@name='url_uri'] = 'url_url'">
  75. <xtscm:urlRSSTask>
  76. <xtscm:searchPath>
  77. <out:value-of select="$path"/>
  78. </xtscm:searchPath>
  79. <out:call-template name="rssTaskObjectCommon">
  80. <out:with-param name="name" select="$name"/>
  81. <out:with-param name="task" select="$task"/>
  82. </out:call-template>
  83. <xtscm:link>
  84. <out:value-of select="$task/param[@name='url_url']"/>
  85. </xtscm:link>
  86. </xtscm:urlRSSTask>
  87. </out:when>
  88. <!--making a shortcut to this agents event list only support hotlist-->
  89. <out:when test="$task/param[@name='url_uri'] = 'url_eventList'">
  90. <xtscm:shortcutAgentRSSTask>
  91. <xtscm:searchPath>
  92. <out:value-of select="$path"/>
  93. </xtscm:searchPath>
  94. <out:call-template name="rssTaskObjectCommon">
  95. <out:with-param name="name" select="$name"/>
  96. <out:with-param name="task" select="$task"/>
  97. </out:call-template>
  98. <xtscm:link>
  99. <xsl:text>hotList</xsl:text>
  100. </xtscm:link>
  101. </xtscm:shortcutAgentRSSTask>
  102. </out:when>
  103. <out:otherwise>
  104. <!--we dont have enough to go on... try and make a url -->
  105. <xtscm:urlRSSTask>
  106. <xtscm:searchPath>
  107. <out:value-of select="$path"/>
  108. </xtscm:searchPath>
  109. <out:call-template name="rssTaskObjectCommon">
  110. <out:with-param name="name" select="$name"/>
  111. <out:with-param name="task" select="$task"/>
  112. </out:call-template>
  113. <xtscm:link>
  114. <out:value-of select="$task/param[@name='url_url']"/>
  115. </xtscm:link>
  116. </xtscm:urlRSSTask>
  117. </out:otherwise>
  118. </out:choose>
  119. </out:template>
  120. <!-- write out the common properties of the rss object in pre-process format-->
  121. <out:template name="rssTaskObjectCommon">
  122. <out:param name="name"/>
  123. <out:param name="task"/>
  124. <out:variable name="user_locale">
  125. <out:choose>
  126. <out:when test="/root/session/param[@name='contentLocale']">
  127. <out:value-of select="/root/session/param[@name='contentLocale']"/>
  128. </out:when>
  129. <out:otherwise>
  130. <out:value-of select="/root/system/param[@name='contentLocale']"/>
  131. </out:otherwise>
  132. </out:choose>
  133. </out:variable>
  134. <!-- here are some properly localised items to introduce when necessary-->
  135. <!--xtscm:name>
  136. <xtscm:tokenvalue>
  137. <out:attribute name="locale">
  138. <out:value-of select="$user_locale"/>
  139. </out:attribute>
  140. <out:value-of select="$task/item/name"/>
  141. </xtscm:tokenvalue>
  142. </xtscm:name-->
  143. <!--xtscm:description>
  144. <xtscm:value>
  145. <out:attribute name="locale">
  146. <out:value-of select="$user_locale"/>
  147. </out:attribute>
  148. <out:value-of select="$task/url_name"/>
  149. </xtscm:value>
  150. </xtscm:description>
  151. <xtscm:description>
  152. <xtscm:value>
  153. <out:attribute name="locale">
  154. <out:value-of select="$user_locale"/>
  155. </out:attribute>
  156. <out:value-of select="$task/url_screentip"/>
  157. </xtscm:value>
  158. </xtscm:description-->
  159. <xtscm:defaultScreenTip>
  160. <out:value-of select="$task/param[@name='url_screentip']"/>
  161. </xtscm:defaultScreenTip>
  162. <xtscm:defaultName>
  163. <out:value-of select="$name"/>
  164. </xtscm:defaultName>
  165. <xtscm:defaultDescription>
  166. <out:value-of select="$task/param[@name='url_description']"/>
  167. </xtscm:defaultDescription>
  168. <!--the title is destined for the name of the url -->
  169. <xtscm:title>
  170. <xtscm:value>
  171. <out:attribute name="locale">
  172. <out:value-of select="$user_locale"/>
  173. </out:attribute>
  174. <out:value-of select="$task/param[@name='url_name']"/>
  175. </xtscm:value>
  176. </xtscm:title>
  177. <xtscm:channel>
  178. <xtscm:baseClass>
  179. <xtscm:searchPath>
  180. <out:value-of select="$task/param[@name='url_location']"/>
  181. </xtscm:searchPath>
  182. </xtscm:baseClass>
  183. </xtscm:channel>
  184. </out:template>
  185. </xsl:template>
  186. <!--
  187. * - This next template is required to copy all other elements into the result.
  188. -->
  189. <xsl:template match="*">
  190. <xsl:copy>
  191. <xsl:copy-of select="@*"/>
  192. <xsl:apply-templates/>
  193. </xsl:copy>
  194. </xsl:template>
  195. </xsl:stylesheet>