V5drillthru.xsl 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  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, 2017
  6. US Government Users Restricted Rights - Use, duplication or disclosure
  7. restricted by GSA ADP Schedule Contract with IBM Corp.
  8. -->
  9. <!-- COPYRIGHT_DATA { 'YEAR':[2015, 2013, 2012, 2011, 2010, 2009, 2005], 'RELEASE':['danube', 'caspian_rp1','caspian', 'colorado_rp1', 'colorado_wave1', 'colorado_wave2'], 'VISIBLE':'YES', 'COMPONENT':'rsvp' }-->
  10. <!--All lines above the COPYRIGHT_DATA line will be replaced when copyright notices are generated. -->
  11. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:rsext="xalan://com.cognos.reportserver.ext.RSExt" extension-element-prefixes="rsext">
  12. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  13. <!--
  14. drill head
  15. -->
  16. <xsl:template name="getDrillThruHead">
  17. <xsl:if test="$appSupport='false'">
  18. <xsl:choose>
  19. <xsl:when test="$drillSupport='yes' and $sdkDrillSupport='false'">
  20. <xsl:text disable-output-escaping="yes">&lt;script type="text/javascript" src="../cr1/drill.js"&gt;&lt;/script&gt;</xsl:text>
  21. <xsl:text disable-output-escaping="yes">&lt;script type="text/javascript" src="../rv/CDrillThroughTarget.js"&gt;&lt;/script&gt;</xsl:text>
  22. <xsl:call-template name="addDrillThroughContext">
  23. <xsl:with-param name="closeScript" select="'yes'"/>
  24. </xsl:call-template>
  25. </xsl:when>
  26. <xsl:when test="$drillSupport='inline' or $sdkDrillSupport='true'">
  27. <xsl:choose>
  28. <xsl:when test="$strict='true'">
  29. <xsl:text disable-output-escaping="yes">&lt;script type="text/javascript"&gt;</xsl:text>
  30. </xsl:when>
  31. <xsl:otherwise>
  32. <xsl:text disable-output-escaping="yes">&lt;script language="javascript" type="text/javascript"&gt;</xsl:text>
  33. </xsl:otherwise>
  34. </xsl:choose>
  35. <xsl:if test="$Xhtml='true' or $strict = 'true'">
  36. <xsl:text disable-output-escaping="yes">
  37. //&lt;![CDATA[
  38. </xsl:text>
  39. </xsl:if>
  40. <xsl:text disable-output-escaping="yes">
  41. function CDrillThroughTarget(label, outputFormat, outputLocale, showInNewWindow, method, path, bookmarkRef, parameters, objectPaths, sPrompt, sendFilterContext, parameterProperties)
  42. {
  43. this.m_label = label;
  44. this.m_outputFormat = outputFormat;
  45. this.m_outputLocale = outputLocale;
  46. this.m_showInNewWindow = showInNewWindow;
  47. this.m_method = method;
  48. this.m_path = path;
  49. this.m_bookmarkRef = bookmarkRef;
  50. this.m_parameters = parameters;
  51. this.m_objectPaths = objectPaths;
  52. this.m_prompt = "false";
  53. this.m_sendFilterContext = sendFilterContext;
  54. this.m_parameterProperties = parameterProperties;
  55. if (typeof sPrompt != 'undefined' &amp;&amp; sPrompt != null)
  56. {
  57. if (sPrompt == 'yes')
  58. {
  59. this.m_prompt = "true";
  60. }
  61. else if (sPrompt == 'target')
  62. {
  63. this.m_prompt = '';
  64. }
  65. }
  66. }
  67. function doSingleDrillThrough(drillThroughContext, bookmarkRef, cvId, bookmarkPage)
  68. {
  69. // handle a single drill
  70. var drillTargetRefIdx = drillThroughContext[0][0];
  71. if(typeof drillTargetRefIdx == "undefined" || drillTargetRefIdx == null)
  72. return;
  73. var drillTargetRef = drillTargets[drillTargetRefIdx];
  74. if(typeof drillTargetRef == "undefined")
  75. return;
  76. // check for the case of a local bookmark
  77. if(bookmarkRef != '' &amp;&amp; drillTargetRef.m_path == '') {
  78. docLocation( bookmarkRef, bookmarkPage );
  79. } else {
  80. var args = new Array;
  81. args[args.length] = new Array("ui.object", drillTargetRef.m_path);
  82. for(var drillParmIdx = 1; drillParmIdx &lt; drillThroughContext.length; ++drillParmIdx) {
  83. args[args.length] = drillThroughContext[drillParmIdx];
  84. }
  85. var drillForm = document.getElementById("multiDrillForm");
  86. if(drillForm == null)
  87. return;
  88. drillForm["ui.action"].value = drillTargetRef.m_method;
  89. drillForm["run.outputFormat"].value = drillTargetRef.m_outputFormat;
  90. drillForm["run.outputLocale"].value = drillTargetRef.m_outputLocale;
  91. drillForm["run.prompt"].value = drillTargetRef.m_prompt;
  92. drillForm["ui.bookmark"].value = bookmarkRef;
  93. if (drillTargetRef.m_method == "view") {
  94. drillForm["ui.object"].value = "defaultOutput(" + args[0][1] + ",\&quot;" + drillTargetRef.m_outputFormat + "\&quot;,\&quot;\&quot;)";
  95. }
  96. else {
  97. drillForm["ui.object"].value = args[0][1];
  98. var formFields = new Array;
  99. for (var i = 1; i &lt; args.length; i++) {
  100. formField = document.createElement(&quot;input&quot;);
  101. formField.setAttribute(&quot;type&quot;, &quot;hidden&quot;);
  102. formField.setAttribute(&quot;name&quot;, args[i][0]);
  103. formField.setAttribute(&quot;value&quot;, args[i][1]);
  104. formFields[formFields.length] = formField;
  105. drillForm.appendChild(formField);
  106. }
  107. drillForm["sourceContext"].value = drillTargetRef.m_parameters;
  108. drillForm["objectPaths"].value = drillTargetRef.m_objectPaths;
  109. }
  110. if (drillTargetRef.m_showInNewWindow == "true") {
  111. drillForm.setAttribute("target","_blank");
  112. }
  113. drillForm.submit();
  114. for (var i = 0; i &lt; formFields.length; i++) {
  115. drillForm.removeChild(formFields[i]);
  116. }
  117. }
  118. }
  119. function doMultipleDrillThrough(drillThroughContext, cvId)
  120. {
  121. // handle multiple drills
  122. var drillThroughTargetStr = '&lt;rvDrillTargets&gt;';
  123. for(var drillTargetIdx = 0; drillTargetIdx &lt; drillThroughContext.length; ++drillTargetIdx) {
  124. var currentDrillThroughContext = drillThroughContext[drillTargetIdx];
  125. if(currentDrillThroughContext.length &lt; 3) {
  126. // there must be three or more parameters (drill idx, drill label and the drill parameters)
  127. continue;
  128. }
  129. var drillTargetRefIdx = currentDrillThroughContext[0];
  130. if(typeof drillTargetRefIdx == "undefined" || drillTargetRefIdx == null)
  131. continue;
  132. var drillTargetLabel = currentDrillThroughContext[1];
  133. if(typeof drillTargetLabel == "undefined" || drillTargetLabel == null)
  134. continue;
  135. var drillTargetRef = drillTargets[drillTargetRefIdx];
  136. if(typeof drillTargetRef == "undefined" || drillTargetRef == null)
  137. continue;
  138. drillThroughTargetStr += '&lt;drillTarget ';
  139. drillThroughTargetStr += 'outputFormat="'; drillThroughTargetStr += drillTargetRef.m_outputFormat; drillThroughTargetStr += '" ';
  140. drillThroughTargetStr += 'outputLocale="'; drillThroughTargetStr += drillTargetRef.m_outputLocale; drillThroughTargetStr += '" ';
  141. drillThroughTargetStr += 'prompt="'; drillThroughTargetStr += drillTargetRef.m_prompt; drillThroughTargetStr += '" ';
  142. drillThroughTargetStr += 'label="'; drillThroughTargetStr += drillTargetLabel; drillThroughTargetStr += '" ';
  143. drillThroughTargetStr += 'path="'; drillThroughTargetStr += drillTargetRef.m_path; drillThroughTargetStr += '" ';
  144. drillThroughTargetStr += 'showInNewWindow="'; drillThroughTargetStr += drillTargetRef.m_showInNewWindow; drillThroughTargetStr += '" ';
  145. drillThroughTargetStr += 'method="'; drillThroughTargetStr += drillTargetRef.m_method; drillThroughTargetStr += '">';
  146. for(var drillParmIdx = 2; drillParmIdx &lt; currentDrillThroughContext.length; ++drillParmIdx) {
  147. drillThroughTargetStr += currentDrillThroughContext[drillParmIdx];
  148. }
  149. drillThroughTargetStr += drillTargetRef.m_parameters;
  150. drillThroughTargetStr += drillTargetRef.m_objectPaths;
  151. drillThroughTargetStr += '&lt;/drillTarget&gt;';
  152. }
  153. drillThroughTargetStr += '&lt;/rvDrillTargets&gt;';
  154. var multiDrillForm = document.getElementById("multiDrillForm");
  155. if(multiDrillForm == null)
  156. return;
  157. multiDrillForm.drillTargets.value = drillThroughTargetStr;
  158. var formField = document.createElement(&quot;input&quot;);
  159. formField.setAttribute(&quot;type&quot;, &quot;hidden&quot;);
  160. formField.setAttribute(&quot;name&quot;, &quot;invokeGotoPage&quot;);
  161. formField.setAttribute(&quot;value&quot;, &quot;true&quot;);
  162. multiDrillForm.appendChild(formField);
  163. multiDrillForm.submit();
  164. multiDrillForm.removeChild(formField);
  165. }
  166. </xsl:text>
  167. <xsl:if test="$Xhtml='true' or $strict = 'true'">
  168. <xsl:text disable-output-escaping="yes">
  169. //]]&gt;
  170. </xsl:text>
  171. </xsl:if>
  172. <xsl:text disable-output-escaping="yes">
  173. &lt;/script&gt;
  174. </xsl:text>
  175. <xsl:call-template name="addDrillThroughContext">
  176. <xsl:with-param name="closeScript" select="'yes'"/>
  177. </xsl:call-template>
  178. </xsl:when>
  179. </xsl:choose>
  180. </xsl:if>
  181. </xsl:template>
  182. <xsl:template name="addDrillThroughContext">
  183. <xsl:param name="closeScript"/>
  184. <xsl:text disable-output-escaping="yes">&lt;script type="text/javascript"&gt;</xsl:text>
  185. <xsl:if test="$Xhtml='true'">
  186. <xsl:text disable-output-escaping="yes">
  187. //&lt;![CDATA[
  188. </xsl:text>
  189. </xsl:if>
  190. var drillThroughTarget;
  191. var drillTargets = new Array;
  192. <xsl:for-each select="/Document/DRILLS/DRILL">
  193. <xsl:variable name="drillThroughParameters">
  194. <!--this template will javascript encode the xml string-->
  195. <xsl:apply-templates select="./*[name()='bus:parameters']" mode="drillTargets"/>
  196. </xsl:variable>
  197. <xsl:variable name="objectPaths">
  198. <!--this template will javascript encode the xml string-->
  199. <xsl:apply-templates select="./*[name()='bus:objectPaths']" mode="drillTargets"/>
  200. </xsl:variable>
  201. <xsl:variable name="parameterProperties">
  202. <!--this template will javascript encode the xml string-->
  203. <xsl:apply-templates select="./PARAMETER-PROPERTIES" mode="drillTargets"/>
  204. </xsl:variable>
  205. <xsl:variable name="outputFormat">
  206. <!--this template will javascript encode the xml string-->
  207. <xsl:choose>
  208. <xsl:when test="./@outputFormat">
  209. <xsl:choose>
  210. <xsl:when test="./@outputFormat='MHT'">
  211. <xsl:text>HTML</xsl:text>
  212. </xsl:when>
  213. <xsl:otherwise>
  214. <xsl:value-of select="./@outputFormat"/>
  215. </xsl:otherwise>
  216. </xsl:choose>
  217. </xsl:when>
  218. <xsl:otherwise>
  219. <xsl:choose>
  220. <xsl:when test="/Document/@outputFormat='MHT'">
  221. <xsl:text>HTML</xsl:text>
  222. </xsl:when>
  223. <xsl:otherwise>
  224. <xsl:value-of select="/Document/@outputFormat"/>
  225. </xsl:otherwise>
  226. </xsl:choose>
  227. </xsl:otherwise>
  228. </xsl:choose>
  229. </xsl:variable>
  230. drillThroughTarget = new CDrillThroughTarget('<xsl:value-of select="rsext:javascriptencode(string(./@label))" disable-output-escaping="yes"/>', '<xsl:value-of select="rsext:javascriptencode(string($outputFormat))" disable-output-escaping="yes"/>', '<xsl:value-of select="rsext:javascriptencode(string(./@outputLocale))" disable-output-escaping="yes"/>', '<xsl:value-of select="rsext:javascriptencode(string(./@showInNewWindow))" disable-output-escaping="yes"/>', '<xsl:value-of select="rsext:javascriptencode(string(./@method))" disable-output-escaping="yes"/>', '<xsl:value-of select="rsext:javascriptencode(string(./@path))" disable-output-escaping="yes"/>', '<xsl:value-of select="rsext:javascriptencode(string(./@bookmarkRef))" disable-output-escaping="yes"/>', '<xsl:value-of select="$drillThroughParameters" disable-output-escaping="yes"/>', '<xsl:value-of select="$objectPaths" disable-output-escaping="yes"/>', '<xsl:value-of select="rsext:javascriptencode(string(./@prompt))" disable-output-escaping="yes"/>', '<xsl:value-of select="rsext:javascriptencode(string(./@sendFilterContext))" disable-output-escaping="yes"/>', '<xsl:value-of select="$parameterProperties" disable-output-escaping="yes"/>');
  231. drillTargets.push(drillThroughTarget);
  232. </xsl:for-each>
  233. <xsl:if test="$closeScript='yes'">
  234. <xsl:if test="$Xhtml='true'">
  235. <xsl:text disable-output-escaping="yes">
  236. //]]&gt;
  237. </xsl:text>
  238. </xsl:if>
  239. <xsl:text disable-output-escaping="yes">&lt;/script&gt;</xsl:text>
  240. </xsl:if>
  241. </xsl:template>
  242. <xsl:template name="getDrillThruBody">
  243. <xsl:if test="($drillSupport='inline' or $sdkDrillSupport='true') and ($appSupport='false')">
  244. <xsl:text disable-output-escaping="yes">&lt;form name="multiDrillForm" id="multiDrillForm" method="post" action="</xsl:text><xsl:value-of select="$gatewayPath"/><xsl:text disable-output-escaping="yes">" style="margin:0px"&gt;
  245. &lt;input type="hidden" name="b_action" value="xts.run"/&gt;
  246. &lt;input type="hidden" name="m" value="portal/drillthrough.xts"/&gt;
  247. &lt;input type="hidden" name="ui.action" value=""/&gt;
  248. &lt;input type="hidden" name="ui.object" value=""/&gt;
  249. &lt;input type="hidden" name="run.outputFormat" value=""/&gt;
  250. &lt;input type="hidden" name="run.outputLocale" value=""/&gt;
  251. &lt;input type="hidden" name="ui.bookmark" value=""/&gt;
  252. &lt;input type="hidden" name="run.prompt" value="false"/&gt;
  253. &lt;input type="hidden" name="nh" value="1"/&gt;
  254. &lt;input type="hidden" name="tb" value="0"/&gt;
  255. &lt;input type="hidden" name="drillTargets" value=""/&gt;
  256. &lt;input type="hidden" name="errURL" value="javascript:window.close()"/&gt;
  257. &lt;input type="hidden" name="backURL" value="javascript:window.close()"/&gt;
  258. &lt;input type="hidden" name="dfemail" value="1"/&gt;
  259. &lt;input type="hidden" name="sourceContext" value=""/&gt;
  260. &lt;input type="hidden" name="objectPaths" value=""/&gt;
  261. &lt;/form>
  262. </xsl:text>
  263. </xsl:if>
  264. </xsl:template>
  265. <!-- drillTargets on chart elements
  266. -->
  267. <xsl:template match="OAREA" priority="1">
  268. <xsl:if test="./drillTargets">
  269. <xsl:choose>
  270. <xsl:when test="$appSupport='true'">
  271. <xsl:attribute name="drillCtx"><xsl:value-of select="./drillTargets/@drillCtx"/></xsl:attribute>
  272. </xsl:when>
  273. <xsl:otherwise>
  274. <xsl:attribute name="style"><xsl:text>cursor:pointer;cursor:hand;</xsl:text></xsl:attribute>
  275. <xsl:call-template name="generateDrillThroughEventHandler">
  276. <xsl:with-param name="node" select="./drillTargets"/>
  277. </xsl:call-template>
  278. </xsl:otherwise>
  279. </xsl:choose>
  280. </xsl:if>
  281. </xsl:template>
  282. <!--
  283. drillTargets on Images
  284. -->
  285. <xsl:template match="OIMG/drillTargets">
  286. <!--
  287. If there is only one drill target, do the work right here and generate the correct URL based on the showInNewWindow attribute
  288. -->
  289. <xsl:if test="$appSupport='false'">
  290. <xsl:attribute name="style">
  291. <xsl:for-each select="../@style"><xsl:value-of select="."/>;</xsl:for-each>
  292. <xsl:text>cursor:pointer;cursor:hand;</xsl:text>
  293. </xsl:attribute>
  294. </xsl:if>
  295. <xsl:choose>
  296. <xsl:when test="$appSupport='true'">
  297. <xsl:attribute name="drillCtx"><xsl:value-of select="@drillCtx"/></xsl:attribute>
  298. </xsl:when>
  299. <xsl:when test="$interactiveOutput='true' and $sdkDrillSupport='false'">
  300. <xsl:attribute name="dtTargets">
  301. <xsl:apply-templates select="*[not(self::OTI)]" mode="drillTargets"/>
  302. </xsl:attribute>
  303. </xsl:when>
  304. <xsl:otherwise>
  305. <xsl:call-template name="generateDrillThroughEventHandler">
  306. <xsl:with-param name="node" select="."/>
  307. </xsl:call-template>
  308. </xsl:otherwise>
  309. </xsl:choose>
  310. </xsl:template>
  311. <!--
  312. drillTargets on TextItems
  313. -->
  314. <xsl:template match="drillTargets">
  315. <xsl:choose>
  316. <xsl:when test="./WRAP">
  317. <div class="q-div">
  318. <xsl:attribute name="style"><xsl:value-of select="./WRAP/@style" /></xsl:attribute>
  319. <xsl:call-template name="generateDrillTargets" />
  320. </div>
  321. </xsl:when>
  322. <xsl:otherwise>
  323. <xsl:call-template name="generateDrillTargets" />
  324. </xsl:otherwise>
  325. </xsl:choose>
  326. </xsl:template>
  327. <xsl:template name="generateDrillTargets">
  328. <span>
  329. <xsl:choose>
  330. <xsl:when test="$appSupport='true'">
  331. <xsl:attribute name="drillCtx"><xsl:value-of select="@drillCtx"/></xsl:attribute>
  332. </xsl:when>
  333. <xsl:when test="$interactiveOutput='true' and $sdkDrillSupport='false'">
  334. <xsl:attribute name="dtTargets">
  335. <xsl:apply-templates select="*[not(self::OTI) and not(self::WRAP)]" mode="drillTargets"/></xsl:attribute>
  336. </xsl:when>
  337. <xsl:otherwise>
  338. <!--
  339. If there is only one drill target, do the work right here and generate the correct URL based on the showInNewWindow attribute
  340. -->
  341. <xsl:attribute name="style"><xsl:text>cursor:pointer;cursor:hand;</xsl:text></xsl:attribute>
  342. <xsl:call-template name="generateDrillThroughEventHandler">
  343. <xsl:with-param name="node" select="."/>
  344. </xsl:call-template>
  345. </xsl:otherwise>
  346. </xsl:choose>
  347. <xsl:apply-templates select="OTI|WRAP/OTI"/>
  348. </span>
  349. </xsl:template>
  350. <xsl:template name="generateDrillThroughEventHandler">
  351. <xsl:param name="node"/>
  352. <xsl:if test="$accessible='true'">
  353. <xsl:attribute name="role">link</xsl:attribute>
  354. </xsl:if>
  355. <xsl:choose>
  356. <xsl:when test="count($node/drillTarget) = 1 and $node/drillTarget/@bookmarkRef != '' and $drillSupport='no'">
  357. <!-- We only get in this template if there is drill information to be rendered
  358. but if drillSupport=no, then we are dealing with a simple bookmark -->
  359. <xsl:variable name="location">
  360. <xsl:text>'</xsl:text>
  361. <xsl:value-of select="rsext:javascriptencode(rsext:replace (rsext:urlencode(string($node/drillTarget/@bookmarkRef)), '+', '-'))"/>
  362. <xsl:text>'</xsl:text>
  363. <xsl:if test="$node/drillTarget/@bookmarkPage">
  364. <xsl:text>, '</xsl:text>
  365. <xsl:value-of select="$node/drillTarget/@bookmarkPage"/>
  366. <xsl:text>'</xsl:text>
  367. </xsl:if>
  368. </xsl:variable>
  369. <xsl:attribute name="onkeypress">if (event.keyCode==13) {docLocation(<xsl:value-of select="$location"/>);}</xsl:attribute>
  370. <xsl:attribute name="onclick">docLocation(<xsl:value-of select="$location"/>)</xsl:attribute>
  371. </xsl:when>
  372. <xsl:otherwise>
  373. <xsl:if test="$strict='false'">
  374. <xsl:attribute name="href"><xsl:text>#</xsl:text></xsl:attribute>
  375. </xsl:if>
  376. <xsl:attribute name="onclick">
  377. <xsl:choose>
  378. <xsl:when test="count($node/drillTarget) = 1">
  379. <xsl:text>doSingleDrillThrough( new Array(</xsl:text>
  380. <xsl:text>new Array("</xsl:text><xsl:value-of select="$node/drillTarget/@drillIdx"/><xsl:text>")</xsl:text>
  381. <xsl:call-template name="paramsArray">
  382. <xsl:with-param name="drillTargetNode" select="$node/drillTarget"/>
  383. </xsl:call-template>
  384. <xsl:text>),'</xsl:text>
  385. <xsl:value-of select="rsext:javascriptencode(string(rsext:replace( rsext:urlencode(string($node/drillTarget/@bookmarkRef)), '+', '-')))"/>
  386. <xsl:text>','_THIS_'</xsl:text>
  387. <xsl:if test="$node/drillTarget/@bookmarkPage">
  388. <xsl:text>, '</xsl:text>
  389. <xsl:value-of select="$node/drillTarget/@bookmarkPage"/>
  390. <xsl:text>'</xsl:text>
  391. </xsl:if>
  392. <xsl:text>);</xsl:text>
  393. </xsl:when>
  394. <xsl:otherwise>
  395. <xsl:text>doMultipleDrillThrough( new Array(</xsl:text>
  396. <xsl:for-each select="$node/drillTarget">
  397. <xsl:text>new Array("</xsl:text><xsl:value-of select="./@drillIdx"/><xsl:text>","</xsl:text><xsl:value-of select="./@label"/><xsl:text>","</xsl:text><xsl:apply-templates select="./*" mode="drillTargets"/><xsl:text>")</xsl:text>
  398. <xsl:if test="position() != last()">
  399. <xsl:text>,</xsl:text>
  400. </xsl:if>
  401. </xsl:for-each>
  402. <xsl:text>),'_THIS_');</xsl:text>
  403. </xsl:otherwise>
  404. </xsl:choose>
  405. </xsl:attribute>
  406. <xsl:attribute name="onkeypress">
  407. <xsl:choose>
  408. <xsl:when test="count($node/drillTarget) = 1">
  409. <xsl:text>doSingleDrillThrough( new Array(</xsl:text>
  410. <xsl:text>new Array("</xsl:text><xsl:value-of select="$node/drillTarget/@drillIdx"/><xsl:text>")</xsl:text>
  411. <xsl:call-template name="paramsArray">
  412. <xsl:with-param name="drillTargetNode" select="$node/drillTarget"/>
  413. </xsl:call-template>
  414. <xsl:text>),'</xsl:text>
  415. <xsl:value-of select="rsext:javascriptencode(string(rsext:replace( rsext:urlencode(string($node/drillTarget/@bookmarkRef)), '+', '-')))"/>
  416. <xsl:text>','_THIS_'</xsl:text>
  417. <xsl:if test="$node/drillTarget/@bookmarkPage">
  418. <xsl:text>,'</xsl:text>
  419. <xsl:value-of select="$node/drillTarget/@bookmarkPage"/>
  420. <xsl:text>'</xsl:text>
  421. </xsl:if>
  422. <xsl:text>);</xsl:text>
  423. </xsl:when>
  424. <xsl:otherwise>
  425. <xsl:text>doMultipleDrillThrough( new Array(</xsl:text>
  426. <xsl:for-each select="$node/drillTarget">
  427. <xsl:text>new Array("</xsl:text><xsl:value-of select="./@drillIdx"/><xsl:text>","</xsl:text><xsl:value-of select="./@label"/><xsl:text>","</xsl:text><xsl:apply-templates select="./*" mode="drillTargets"/><xsl:text>")</xsl:text>
  428. <xsl:if test="position() != last()">
  429. <xsl:text>,</xsl:text>
  430. </xsl:if>
  431. </xsl:for-each>
  432. <xsl:text>),'_THIS_');</xsl:text>
  433. </xsl:otherwise>
  434. </xsl:choose>
  435. </xsl:attribute>
  436. </xsl:otherwise>
  437. </xsl:choose>
  438. </xsl:template>
  439. <!--
  440. Build up the parameters array
  441. -->
  442. <xsl:template name="paramsArray">
  443. <xsl:param name="drillTargetNode"/>
  444. <xsl:variable name="drillTargetLabel" select="$drillTargetNode/@label"/>
  445. <xsl:for-each select="$drillTargetNode/drillParameter">
  446. <xsl:choose>
  447. <xsl:when test="./@value!=''">
  448. <xsl:variable name="selectChoices">
  449. <xsl:choose>
  450. <!--when selectChoices element is passed through, it's has already been xml encoded, so don't double encode it -->
  451. <xsl:when test="starts-with(normalize-space(string(./@value)), '&lt;selectChoices&gt;')">
  452. <xsl:value-of select="string(./@value)"/>
  453. </xsl:when>
  454. <xsl:otherwise>
  455. <xsl:text>&lt;selectChoices&gt;</xsl:text>
  456. <xsl:text>&lt;selectOption </xsl:text>
  457. <xsl:text>useValue=&quot;</xsl:text>
  458. <xsl:value-of select="rsext:xmlencode(string(./@value))"/>
  459. <xsl:text>&quot; </xsl:text>
  460. <xsl:if test="./@mun!=''">
  461. <xsl:text>mun=&quot;</xsl:text>
  462. <xsl:value-of select="rsext:xmlencode(string(./@mun))"/>
  463. <xsl:text>&quot; </xsl:text>
  464. </xsl:if>
  465. <xsl:variable name="parameterName" select="@name"/>
  466. <xsl:if test="/Document/DRILLS/DRILL[@label = string($drillTargetLabel)]/PARAMETER-PROPERTIES/Parameter[@name=string($parameterName)]/@propertyToPass != ''">
  467. <xsl:text>propertyToPass=&quot;</xsl:text>
  468. <xsl:value-of select="rsext:xmlencode(string(/Document/DRILLS/DRILL[@label = string($drillTargetLabel)]/PARAMETER-PROPERTIES/Parameter[@name=string($parameterName)]/@propertyToPass))"/>
  469. <xsl:text>&quot; </xsl:text>
  470. </xsl:if>
  471. <xsl:text>displayValue=&quot;</xsl:text>
  472. <xsl:choose>
  473. <xsl:when test="./@displayValue"><xsl:value-of select="rsext:xmlencode(string(./@displayValue))"/></xsl:when>
  474. <xsl:otherwise><xsl:value-of select="rsext:xmlencode(string(./@value))"/></xsl:otherwise>
  475. </xsl:choose>
  476. <xsl:text>&quot;/&gt;</xsl:text>
  477. <xsl:text>&lt;/selectChoices&gt;</xsl:text>
  478. </xsl:otherwise>
  479. </xsl:choose>
  480. </xsl:variable>
  481. <xsl:text>, new Array("p_</xsl:text><xsl:value-of select="rsext:javascriptencode(string(./@name))" disable-output-escaping="yes"/><xsl:text>","</xsl:text><xsl:value-of select="rsext:javascriptencode(string($selectChoices))" disable-output-escaping="yes"/><xsl:text>")</xsl:text>
  482. </xsl:when>
  483. <xsl:otherwise>
  484. <xsl:variable name="selectChoices">
  485. <xsl:text>&lt;selectChoices&gt;</xsl:text>
  486. <xsl:text>&lt;/selectChoices&gt;</xsl:text>
  487. </xsl:variable>
  488. <xsl:text>, new Array("p_</xsl:text><xsl:value-of select="rsext:javascriptencode(string(./@name))" disable-output-escaping="yes"/><xsl:text>","</xsl:text><xsl:value-of select="rsext:javascriptencode(string($selectChoices))" disable-output-escaping="yes"/><xsl:text>")</xsl:text>
  489. </xsl:otherwise>
  490. </xsl:choose>
  491. </xsl:for-each>
  492. </xsl:template>
  493. <xsl:template match="*" mode="drillTargets">
  494. <xsl:text>&lt;</xsl:text>
  495. <xsl:value-of select="name()"/>
  496. <xsl:apply-templates select="@*" mode="drillTargets"/>
  497. <xsl:if test="local-name()='drillParameter'">
  498. <xsl:variable name="parameterName" select="@name"/>
  499. <xsl:variable name="drillTargetLabel" select="../@label"/>
  500. <xsl:if test="/Document/DRILLS/DRILL[@label = string($drillTargetLabel)]/PARAMETER-PROPERTIES/Parameter[@name=string($parameterName)]/@propertyToPass != ''">
  501. <xsl:text>&#32;propertyToPass=\"</xsl:text>
  502. <xsl:value-of select="rsext:xmlencode(string(/Document/DRILLS/DRILL[@label = string($drillTargetLabel)]/PARAMETER-PROPERTIES/Parameter[@name=string($parameterName)]/@propertyToPass))"/>
  503. <xsl:text>\"</xsl:text>
  504. </xsl:if>
  505. </xsl:if>
  506. <xsl:text>/&gt;</xsl:text>
  507. </xsl:template>
  508. <!-- generate text for an element with children or text -->
  509. <xsl:template match="*[* | text()]" mode="drillTargets">
  510. <xsl:text>&lt;</xsl:text>
  511. <xsl:value-of select="name()"/>
  512. <xsl:apply-templates select="@*" mode="drillTargets"/>
  513. <xsl:text>&gt;</xsl:text>
  514. <xsl:apply-templates select="* | text()" mode="drillTargets"/>
  515. <xsl:text>&lt;\/</xsl:text>
  516. <xsl:value-of select="name()"/>
  517. <xsl:text>&gt;</xsl:text>
  518. </xsl:template>
  519. <!-- generate text for an attribute -->
  520. <xsl:template match="@*" mode="drillTargets">
  521. <xsl:text>&#32;</xsl:text>
  522. <xsl:value-of select="name()"/>
  523. <xsl:text>=\"</xsl:text>
  524. <xsl:value-of select="rsext:javascriptencode(rsext:xmlencode(string(.)))"/>
  525. <xsl:text>\"</xsl:text>
  526. </xsl:template>
  527. <!-- generate text -->
  528. <xsl:template match="text()" mode="drillTargets">
  529. <xsl:value-of select="rsext:xmlencode(string(.))"/>
  530. </xsl:template>
  531. <!-- We do not want any of the OTI stuff -->
  532. <xsl:template match="OTI" mode="drillTargets">
  533. <!-- do nothing -->
  534. </xsl:template>
  535. </xsl:stylesheet>