V5html_viewer.xsl 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: rsvp
  5. (C) Copyright IBM Corp. 2005, 2019
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rsext="xalan://com.cognos.reportserver.ext.RSExt" version="1.0" extension-element-prefixes="rsext">
  10. <xsl:import href="V5environment.xsl"/>
  11. <xsl:variable name="isNewViewer" select="'true'"/>
  12. <xsl:param name="renderIntermediateXML" select="''"/>
  13. <xsl:param name="renderEnvironment" select="''"/>
  14. <xsl:include href="V5ReportEngine.xsl"/>
  15. <xsl:include href="V5drillthru.xsl"/>
  16. <xsl:include href="prompting.xsl"/>
  17. <xsl:include href="viewer_debug.xsl"/>
  18. <xsl:include href="../../ps/prompting/p_include_V5ParamSafe.xsl"/>
  19. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  20. <xsl:variable name="promptLocale" select="$contentLocale"/>
  21. <xsl:variable name="promptFormName" select="'formWarpRequest'"/>
  22. <xsl:variable name="sGenerateContextData" select="'true'"/>
  23. <xsl:template match="/Document">
  24. <xsl:if test="$firstPage='true'">
  25. <xsl:text disable-output-escaping="yes">&lt;html xmlns:xlink="http://www.w3.org/1999/xlink" lang="</xsl:text>
  26. <xsl:value-of select="$contentLocale"/>
  27. <xsl:text disable-output-escaping="yes">"&gt;
  28. </xsl:text>
  29. <xsl:text disable-output-escaping="yes">&lt;head&gt;</xsl:text>
  30. <xsl:call-template name="ViewerDebug"/>
  31. <xsl:apply-templates select="/Document/styleOptions"/>
  32. <xsl:text disable-output-escaping="yes">
  33. &lt;title&gt;</xsl:text>
  34. <xsl:value-of select="$reportTitle" disable-output-escaping="yes"/>
  35. <xsl:text disable-output-escaping="yes">&lt;/title&gt;
  36. </xsl:text>
  37. <xsl:text disable-output-escaping="yes">
  38. &lt;metaData&gt;&lt;![CDATA[</xsl:text>
  39. <xsl:value-of select="string(/Document/META-DATA/Block)" disable-output-escaping="yes"/>
  40. <xsl:text disable-output-escaping="yes">]]&gt;&lt;/metaData&gt;
  41. </xsl:text>
  42. <xsl:text disable-output-escaping="yes">
  43. &lt;ctxData&gt;&lt;![CDATA[</xsl:text>
  44. <xsl:value-of select="string(/Document/CONTEXT-DATA/*[local-name()=$contextBlock])" disable-output-escaping="yes"/>
  45. <xsl:text disable-output-escaping="yes">]]&gt;&lt;/ctxData&gt;
  46. </xsl:text>
  47. <ASPS>
  48. <xsl:if test="$PRMT_allowEmptyStrings='false'">
  49. <ASP name="allowEmptyStrings" value="false"/>
  50. </xsl:if>
  51. <xsl:if test="$PRMT_allowEmptyStringTextHeader='false'">
  52. <ASP name="allowEmptyStringTextHeader" value="false"/>
  53. </xsl:if>
  54. </ASPS>
  55. <xsl:if test="dataStores">
  56. <xsl:text disable-output-escaping="yes">
  57. </xsl:text>
  58. <dataStores>
  59. <xsl:for-each select="dataStores/dataStore">
  60. <xsl:text disable-output-escaping="yes">
  61. </xsl:text>
  62. <dataStore>
  63. <xsl:for-each select="@*">
  64. <xsl:choose>
  65. <xsl:when test="self::node()[name() = 'layoutClass']">
  66. <!-- Skip this one -->
  67. </xsl:when>
  68. <xsl:when test="self::node()[name() = 'srcsave' or name() = 'srcsaveAs']">
  69. <!-- output as src -->
  70. <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute>
  71. </xsl:when>
  72. <xsl:otherwise>
  73. <xsl:copy-of select="."/>
  74. </xsl:otherwise>
  75. </xsl:choose>
  76. </xsl:for-each>
  77. <xsl:for-each select="./geoStore">
  78. <xsl:text disable-output-escaping="yes">
  79. </xsl:text>
  80. <geoStore>
  81. <xsl:for-each select="@*">
  82. <xsl:choose>
  83. <xsl:when test="self::node()[name() = 'srcsave' or name() = 'srcsaveAs']">
  84. <!-- output as src -->
  85. <xsl:attribute name="src"><xsl:value-of select="."/></xsl:attribute>
  86. </xsl:when>
  87. <xsl:otherwise>
  88. <xsl:copy-of select="."/>
  89. </xsl:otherwise>
  90. </xsl:choose>
  91. </xsl:for-each>
  92. </geoStore>
  93. </xsl:for-each>
  94. <xsl:text disable-output-escaping="yes">
  95. </xsl:text>
  96. </dataStore>
  97. </xsl:for-each>
  98. <xsl:text disable-output-escaping="yes">
  99. </xsl:text>
  100. </dataStores>
  101. <xsl:text disable-output-escaping="yes">
  102. </xsl:text>
  103. </xsl:if>
  104. <!--
  105. <xsl:if test="$drillSupport!='no'">
  106. <xsl:call-template name="getDrillThruHead"/>
  107. </xsl:if>
  108. -->
  109. <!-- <xsl:call-template name="chartConfig"/> -->
  110. <!-- <xsl:call-template name="parentViewerScript"/> -->
  111. <!-- <xsl:call-template name="preProcess"/> -->
  112. <PageCache>
  113. <xsl:attribute name="index"><xsl:value-of select="$pageCacheIndex"/></xsl:attribute>
  114. <xsl:attribute name="reset"><xsl:value-of select="$resetPageCache"/></xsl:attribute>
  115. </PageCache>
  116. <xsl:apply-templates select="/Document/ReportPageSet"/>
  117. <xsl:apply-templates select="/Document/DRILLS"/>
  118. <xsl:text disable-output-escaping="yes">
  119. &lt;/head&gt;
  120. &lt;body</xsl:text>
  121. <xsl:if test="$accessible='true'">
  122. <xsl:choose>
  123. <xsl:when test="$appSupport='false'">
  124. <xsl:text disable-output-escaping="yes"> role="main"</xsl:text>
  125. </xsl:when>
  126. <xsl:otherwise>
  127. <xsl:text disable-output-escaping="yes"> role="application"</xsl:text>
  128. </xsl:otherwise>
  129. </xsl:choose>
  130. </xsl:if>
  131. <xsl:text disable-output-escaping="yes">&gt;
  132. </xsl:text>
  133. </xsl:if>
  134. <xsl:apply-templates select="DATA"/>
  135. <xsl:if test="$lastPage='true'">
  136. <xsl:call-template name="getDrillThruBody"/>
  137. <!-- <xsl:call-template name="postProcess"/> -->
  138. <xsl:text disable-output-escaping="yes">
  139. &lt;/body&gt;
  140. &lt;/html&gt;
  141. </xsl:text>
  142. </xsl:if>
  143. </xsl:template>
  144. <xsl:template name="startPage"/>
  145. <!-- used in selection -->
  146. <xsl:template name="GenEventHandlers">
  147. <xsl:if test="$sGenerateContextData='true' and (@layoutClass='listColumnBody' or @layoutClass='listColumnTitle' or @layoutClass='rowCell' or @layoutClass='crosstabFactCell' or @layoutClass='crosstabNodeMember' or @layoutClass='crosstabCorner' or @layoutClass='repeaterTableCell' or name()='OCHART')">
  148. <xsl:copy-of select="@ctx"/>
  149. <xsl:if test="@class">
  150. <xsl:copy-of select="@class"/>
  151. </xsl:if>
  152. <!--
  153. <xsl:if test="$appSupport='false'">
  154. <xsl:copy-of select="@type"/>
  155. </xsl:if>
  156. -->
  157. </xsl:if>
  158. </xsl:template>
  159. <xsl:template match="OCLI[@layoutClass='listControl']" priority="2">
  160. <listControl>
  161. <xsl:copy-of select="@*[name(.) != 'layoutClass']"/>
  162. <xsl:copy-of select="HA/@*[name(.) != 'layoutClass']"/>
  163. </listControl>
  164. </xsl:template>
  165. <!-- used to add events to the main page for selection -->
  166. <xsl:template match="*[@layoutClass='textItem']" priority="1">
  167. <span>
  168. <xsl:call-template name="GenTabIndexAttribute"/>
  169. <xsl:call-template name="AddAccessibleTagsForSpan"/>
  170. <xsl:copy-of select="@ctx"/>
  171. <xsl:call-template name="GenCommonAttributes"/>
  172. <xsl:value-of select="rsext:htmlencode(string(.))" disable-output-escaping="yes"/>
  173. </span>
  174. </xsl:template>
  175. <xsl:template match="OAREA" priority="2">
  176. <xsl:if test="MEMBER or drillTargets or MEASURE">
  177. <xsl:choose>
  178. <xsl:when test="@type='legendTitle'">
  179. <xsl:attribute name="isChartTitle">true</xsl:attribute>
  180. </xsl:when>
  181. </xsl:choose>
  182. <xsl:choose>
  183. <xsl:when test="@type='ordinalAxisTitle'">
  184. <xsl:attribute name="isChartTitle">true</xsl:attribute>
  185. </xsl:when>
  186. </xsl:choose>
  187. <xsl:if test="./drillTargets">
  188. <xsl:choose>
  189. <xsl:when test="count(./drillTargets/drillTarget) = 1 and ./drillTargets/drillTarget/@bookmarkRef != '' and $drillSupport='no'">
  190. <!-- We only get in this template if there is drill information to be rendered
  191. but if drillSupport=no, then we are dealing with a simple bookmark -->
  192. <xsl:attribute name="href"><xsl:text disable-output-escaping="yes">#</xsl:text><xsl:value-of select="rsext:replace (rsext:urlencode(string(./drillTargets/drillTarget/@bookmarkRef)), '+', '-')"/></xsl:attribute>
  193. </xsl:when>
  194. <xsl:otherwise>
  195. <xsl:call-template name="createDrillTarget">
  196. <xsl:with-param name="node" select="./drillTargets"/>
  197. </xsl:call-template>
  198. </xsl:otherwise>
  199. </xsl:choose>
  200. </xsl:if>
  201. </xsl:if>
  202. </xsl:template>
  203. <xsl:template match="styleOptions">
  204. <xsl:text disable-output-escaping="yes">
  205. </xsl:text>
  206. <styleOptions>
  207. <xsl:text disable-output-escaping="yes">
  208. </xsl:text>
  209. <xsl:copy-of select="cssUrl[contains(text(),'GlobalReportStyles')]"/>
  210. <xsl:text disable-output-escaping="yes">
  211. </xsl:text>
  212. <xsl:copy-of select="namedCssStyleText"/>
  213. <xsl:text disable-output-escaping="yes">
  214. </xsl:text>
  215. </styleOptions>
  216. </xsl:template>
  217. <xsl:template match="ReportPageSet">
  218. <TabSet>
  219. <xsl:call-template name="createJsonTabset">
  220. <xsl:with-param name="node" select="."/>
  221. </xsl:call-template>
  222. </TabSet>
  223. </xsl:template>
  224. <xsl:template match="DRILLS">
  225. <xsl:text disable-output-escaping="yes">
  226. &lt;DRILLS&gt;
  227. </xsl:text>
  228. <xsl:for-each select="DRILL">
  229. <xsl:copy-of select="."/>
  230. <xsl:text disable-output-escaping="yes">
  231. </xsl:text>
  232. </xsl:for-each>
  233. <xsl:text disable-output-escaping="yes">&lt;/DRILLS&gt;
  234. </xsl:text>
  235. </xsl:template>
  236. <!--
  237. drillTargets on TextItems
  238. -->
  239. <xsl:template match="drillTargets">
  240. <xsl:choose>
  241. <xsl:when test="./WRAP">
  242. <div class="q-div">
  243. <xsl:attribute name="style"><xsl:value-of select="./WRAP/@style"/></xsl:attribute>
  244. <xsl:call-template name="createDrillTargets"/>
  245. </div>
  246. </xsl:when>
  247. <xsl:otherwise>
  248. <xsl:call-template name="createDrillTargets"/>
  249. </xsl:otherwise>
  250. </xsl:choose>
  251. </xsl:template>
  252. <xsl:template name="createDrillTargets">
  253. <span>
  254. <xsl:call-template name="createDrillTarget">
  255. <xsl:with-param name="node" select="."/>
  256. </xsl:call-template>
  257. <xsl:apply-templates select="OTI|WRAP/OTI"/>
  258. </span>
  259. </xsl:template>
  260. <!--
  261. drillTargets on Images
  262. -->
  263. <xsl:template match="OIMG/drillTargets">
  264. <xsl:call-template name="createDrillTarget">
  265. <xsl:with-param name="node" select="."/>
  266. </xsl:call-template>
  267. </xsl:template>
  268. <xsl:template name="createDrillTarget">
  269. <xsl:param name="node"/>
  270. <xsl:attribute name="dt">[<xsl:for-each select="$node/drillTarget"><xsl:if test="position() > 1">,</xsl:if>{"i":<xsl:value-of select="@drillIdx"/><xsl:if test="@bookmarkRef">,"b":"<xsl:value-of select="rsext:jsonencode(rsext:replace(rsext:urlencode(string(@bookmarkRef)), '+', '-'))"/>"</xsl:if>,"p":[<xsl:for-each select="drillParameter"><xsl:if test="position() > 1">,</xsl:if>{"n":"<xsl:value-of select="rsext:jsonencode(@name)"/>"<xsl:if test="@value">,"v":"<xsl:value-of select="rsext:jsonencode(rsext:xmlencode(@value))"/>"</xsl:if><xsl:if test="@displayValue">,"d":"<xsl:value-of select="rsext:jsonencode(@displayValue)"/>"</xsl:if><xsl:if test="@mun">,"m":"<xsl:value-of select="rsext:jsonencode(@mun)"/>"</xsl:if>}</xsl:for-each>]}</xsl:for-each>]</xsl:attribute>
  271. </xsl:template>
  272. <xsl:template match="dataStore" priority="2">
  273. <dataStore>
  274. <xsl:choose>
  275. <xsl:when test="@src">
  276. <xsl:call-template name="GenDataStore"/>
  277. </xsl:when>
  278. <xsl:otherwise>
  279. <xsl:copy-of select="@name"/>
  280. <xsl:text disable-output-escaping="yes">&lt;![CDATA[</xsl:text>
  281. <xsl:value-of select="string(.)" disable-output-escaping="yes"/>
  282. <xsl:text disable-output-escaping="yes">]]&gt;</xsl:text>
  283. </xsl:otherwise>
  284. </xsl:choose>
  285. </dataStore>
  286. </xsl:template>
  287. <xsl:template match="UNKNOWN[@layoutClass='vizControl']">
  288. <vizControl>
  289. <xsl:copy-of select="HA/@roid"/>
  290. <xsl:copy-of select="HA/@specname"/>
  291. </vizControl>
  292. </xsl:template>
  293. <xsl:template match="NB[@layoutClass='notebook']">
  294. <notebook>
  295. <xsl:copy-of select="@*[name(.) != 'layoutClass']"/>
  296. <xsl:copy-of select="HA/@*[name(.) != 'layoutClass']"/>
  297. <xsl:value-of select="string(RP)" disable-output-escaping="yes"/>
  298. </notebook>
  299. </xsl:template>
  300. </xsl:stylesheet>