generateParams.xslt 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  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, 2016
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. expects the following
  10. <root xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  11. <options xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xsi:type="cm:optionArrayProp">
  12. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:option[2]">
  13. <item xsi:type="cm:runOptionStringArray">
  14. <name xsi:type="cm:runOptionEnum">outputFormat</name>
  15. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[2]">
  16. <item xsi:type="xsd:string">PDF</item>
  17. <item xsi:type="xsd:string">HTML</item>
  18. </value>
  19. </item>
  20. ...
  21. </value>
  22. </options>
  23. <reportOptions>
  24. <options xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xsi:type="cm:optionArrayProp">
  25. <value xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:option[2]">
  26. ...
  27. </value>
  28. </options>
  29. </reportOptions>
  30. <deliverySection>true</deliverySection> are we dealing with a delivery section
  31. <obj>
  32. <report>
  33. ...
  34. </report>
  35. </obj>
  36. <preferences>
  37. <item xsi:type="bus:userPreferenceVar">
  38. <name xsi:type="xsd:string">timeZoneID</name>
  39. <value xsi:type="xsd:string">EST</value>
  40. </item>
  41. ....
  42. </preferences>
  43. <capabilities>...</capabilities>
  44. <saveAsPath>...</saveAsPath> override for the default saveAsPath (default is parent searchPath)
  45. <save_how>...</save_how> override for the default save_how (default is report)
  46. <basicOptions>false</basicOptions> are we building env params for a basic option dialog (dropdown menus for format and language)
  47. <optionList include="true | false"> can let the transform know if it should only generate params for a fixed list, or if it shouldn't generate params for the listed options
  48. <item>outputFormat</item>
  49. <item>outputLocale</item>
  50. ...
  51. </optionList>
  52. <defaultArchiveLocation>
  53. <archiveLocation>
  54. <searchPath type="cm:stringProp">/configuration/archiveLocation[@name='fileLocation']</searchPath>
  55. <defaultName type="cm:tokenProp">fileLocation</defaultName>
  56. </archiveLocation>
  57. </defaultArchiveLocation>
  58. </root>
  59. -->
  60. <xsl:stylesheet version="1.0"
  61. xmlns:cm="http://developer.cognos.com/schemas/bibus/3/"
  62. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  63. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  64. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  65. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  66. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  67. xmlns:set="http://exslt.org/sets"
  68. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  69. exclude-result-prefixes="cm xsd xsi xsl xts SOAP-ENC xtsext set">
  70. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  71. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  72. <xsl:key name="system-param" match="/root/system/param" use="@name"/>
  73. <xsl:key name="option-list" match="/root/optionList/item" use="."/>
  74. <xsl:variable name="env" select="/root/env"/>
  75. <xsl:variable name="object" select="/root/obj/*"/>
  76. <xsl:template match="/root" priority="3">
  77. <xsl:variable name="items" select="*[local-name()='options']/*[local-name()='value']/*[local-name()='item']"/>
  78. <xsl:variable name="optionGroups" select="set:distinct($items/*[local-name()='name']/@*[local-name()='type'])"/>
  79. <xsl:for-each select="$optionGroups">
  80. <xsl:variable name="groupName" select="."/>
  81. <xsl:call-template name="processOptions">
  82. <xsl:with-param name="options" select="set:distinct($items/*[local-name()='name' and @*[local-name()='type']=$groupName])/.."/>
  83. </xsl:call-template>
  84. </xsl:for-each>
  85. <xsl:variable name="allowRestrictedDefaults" select="/root/allowRestrictedDefaults"/>
  86. <xsl:variable name="scheduleOptionsExist" select="/root/scheduleOptionsExist"/>
  87. <xsl:variable name="allowPDF"><xsl:if test="/root/capabilities and not(/root/capabilities/canGeneratePDFOutput)">false</xsl:if></xsl:variable>
  88. <xsl:variable name="allowXML"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateXMLOutput)">false</xsl:if></xsl:variable>
  89. <xsl:variable name="allowCSV"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateCSVOutput)">false</xsl:if></xsl:variable>
  90. <xsl:variable name="allowXLS"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateXLSOutput)">false</xsl:if></xsl:variable>
  91. <!-- do this when schedule options exist for a restricted user -->
  92. <xsl:if test="/root/scheduleOptionsExist != 'true' and ($allowPDF='false' or $allowXML='false' or $allowCSV='false' or $allowXLS='false')">
  93. <param name="override_outputFormat_option"><xsl:value-of select="'true'"/></param>
  94. </xsl:if>
  95. <!-- if we have a delivery section, then make sure we always have the appropriate env params -->
  96. <xsl:if test="/root/deliverySection = 'true' and not($items/*[local-name()='name'] = 'saveAs')">
  97. <param name="m_ro_saveAsType">reportView</param>
  98. <xsl:variable name="saveAsName"><xts:string id="IDS_ACT_CUSTOM_OF"><xts:param name="curName"><xsl:value-of select="$object/*[local-name()='defaultName']"/></xts:param></xts:string></xsl:variable>
  99. <param name="m_ro_saveAsName">
  100. <xsl:choose>
  101. <xsl:when test="string-length($saveAsName) > 256"><xsl:value-of select="substring($saveAsName,0,257)"/></xsl:when>
  102. <xsl:otherwise><xsl:value-of select="$saveAsName"/></xsl:otherwise>
  103. </xsl:choose>
  104. </param>
  105. <param name="m_ro_saveAsPath">
  106. <xsl:choose>
  107. <xsl:when test="/root/saveAsPath != ''">
  108. <xsl:value-of select="/root/saveAsPath"/>
  109. </xsl:when>
  110. <xsl:otherwise>
  111. <xsl:value-of select="$object/*[local-name()='parent']/*/*[local-name()='searchPath']"/>
  112. </xsl:otherwise>
  113. </xsl:choose>
  114. </param>
  115. <param name="save_how">
  116. <xsl:choose>
  117. <xsl:when test="/root/save_how != ''">
  118. <xsl:value-of select="/root/save_how"/>
  119. </xsl:when>
  120. <xsl:otherwise>report</xsl:otherwise>
  121. </xsl:choose>
  122. </param>
  123. </xsl:if>
  124. <!-- if we have a delivery section, then make sure we always have the default archive options -->
  125. <xsl:if test="/root/deliverySection = 'true' and not($items/*[local-name()='name'] = 'conflictResolution')">
  126. <param name="m_arc_conflictResolution">replace</param>
  127. <param name="m_arc_archiveLocation"><xsl:value-of select="/root/defaultArchiveLocation/*[local-name()='archiveLocation']/*[local-name()='searchPath']"/></param>
  128. </xsl:if>
  129. <!-- should we default the format and locale? -->
  130. <xsl:if test="/root/*[local-name()='defaultOptions']='true'">
  131. <xsl:call-template name="generateDefaults"/>
  132. </xsl:if>
  133. </xsl:template>
  134. <!-- handles the case where the user specified an optionList -->
  135. <xsl:template name="processOptions">
  136. <xsl:param name="options"/>
  137. <xsl:choose>
  138. <xsl:when test="/root/optionList != ''">
  139. <xsl:choose>
  140. <xsl:when test="/root/optionList[@include = 'true']">
  141. <xsl:apply-templates select="$options[key('option-list',*[local-name()='name'])]"/>
  142. </xsl:when>
  143. <xsl:otherwise>
  144. <xsl:apply-templates select="$options[not(key('option-list',*[local-name()='name']))]"/>
  145. </xsl:otherwise>
  146. </xsl:choose>
  147. </xsl:when>
  148. <xsl:otherwise>
  149. <xsl:apply-templates select="$options"/>
  150. </xsl:otherwise>
  151. </xsl:choose>
  152. </xsl:template>
  153. <!--
  154. special handling for the printers
  155. -->
  156. <xsl:template match="*[./*[local-name()='name']='printerAddress' or ./*[local-name()='name']='printer' ]" priority="2">
  157. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  158. <param name="{concat('m_ro_',$optionName)}"><xsl:value-of select="./*[local-name()='value']"/></param>
  159. <xsl:choose>
  160. <xsl:when test="$optionName = 'printerAddress'">
  161. <param name="ro_printer_kw">printerAddress</param>
  162. </xsl:when>
  163. <xsl:otherwise>
  164. <param name="ro_printer_kw">printer</param>
  165. </xsl:otherwise>
  166. </xsl:choose>
  167. </xsl:template>
  168. <!-- special handling for promtpCacheMode. If we're dealing with a schedule, then set to 'none' -->
  169. <xsl:template match="*[./*[local-name()='name']='promptCacheMode']" priority="1">
  170. <xsl:choose>
  171. <xsl:when test="/root/scheduleOptionsExist = 'true'">
  172. <param name="{concat('m_ro_',./*[local-name()='name'])}">none</param>
  173. </xsl:when>
  174. <xsl:otherwise>
  175. <param name="{concat('m_ro_',./*[local-name()='name'])}"><xsl:value-of select="./*[local-name()='value']"/></param>
  176. </xsl:otherwise>
  177. </xsl:choose>
  178. </xsl:template>
  179. <!-- special handling for busting. If we're default step options from jobOptions then don't grab the burst run option -->
  180. <xsl:template match="*[./*[local-name()='name']='burst']" priority="2">
  181. <xsl:if test="not(/root/usingJobOptions) or /root/usingJobOptions='false' or /root/canBurst = 'true'">
  182. <param name="{concat('m_ro_',./*[local-name()='name'])}"><xsl:value-of select="./*[local-name()='value']"/></param>
  183. </xsl:if>
  184. </xsl:template>
  185. <!--
  186. pdfOptionBoolean and pdfOptionPrintQuality
  187. -->
  188. <xsl:template match="*[contains(@xsi:type,':pdfOptionBoolean') or contains(@xsi:type, ':pdfOptionPrintQuality')]" priority="1">
  189. <param name="{concat('m_pdf_',./*[local-name()='name'])}"><xsl:value-of select="./*[local-name()='value']"/></param>
  190. </xsl:template>
  191. <!--
  192. pdfOptionXMLEncodedXML
  193. -->
  194. <xsl:template match="*[contains(@xsi:type, ':pdfOptionXMLEncodedXML')]" priority="1">
  195. <param name="{concat('m_pdf_',./*[local-name()='name'], '_runOption_Encrypted')}"><xsl:value-of select="./*[local-name()='value']"/></param>
  196. </xsl:template>
  197. <!-- archive options -->
  198. <xsl:template match="*[contains(@xsi:type, ':archiveOptionConflictResolution') or contains(@xsi:type, ':archiveOptionString') or contains(@xsi:type, ':archiveOptionSearchPathSingleObject')]" priority="1">
  199. <param name="{concat('m_arc_',./*[local-name()='name'])}"><xsl:value-of select="./*[local-name()='value']"/></param>
  200. </xsl:template>
  201. <!--
  202. jobOptionBoolean
  203. -->
  204. <xsl:template match="*[contains(@xsi:type,':jobOptionBoolean')]" priority="1">
  205. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  206. <param name="{concat('m_jo_',$optionName)}"><xsl:value-of select="./*[local-name()='value']"/></param>
  207. </xsl:template>
  208. <!--
  209. monitorOptionBoolean
  210. -->
  211. <xsl:template match="*[contains(@xsi:type,':monitorOptionBoolean')]" priority="1">
  212. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  213. <param name="{concat('m_mo_',$optionName)}"><xsl:value-of select="./*[local-name()='value']"/></param>
  214. </xsl:template>
  215. <!--
  216. indexOptionBoolean
  217. -->
  218. <xsl:template match="*[contains(@xsi:type,':indexOptionBoolean')]" priority="1">
  219. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  220. <param name="{concat('m_io_',$optionName)}"><xsl:value-of select="./*[local-name()='value']"/></param>
  221. </xsl:template>
  222. <!--
  223. agentOptionBoolean
  224. -->
  225. <xsl:template match="*[contains(@xsi:type,':agentOptionBoolean')]" priority="1">
  226. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  227. <param name="{concat('m_ao_',$optionName)}"><xsl:value-of select="./*[local-name()='value']"/></param>
  228. </xsl:template>
  229. <!--
  230. genericOptionBoolean
  231. -->
  232. <xsl:template match="*[contains(@xsi:type,':genericOptionBoolean')]" priority="1">
  233. <xsl:variable name="optionName" select="substring-after(./*[local-name()='name'],'#')"/>
  234. <param name="{concat('m_go_',$optionName)}"><xsl:value-of select="./*[local-name()='value']"/></param>
  235. </xsl:template>
  236. <!--
  237. dataIntegrationTaskOptionBoolean
  238. -->
  239. <xsl:template match="*[contains(@xsi:type,':dataIntegrationTaskOptionBoolean')]" priority="1">
  240. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  241. <param name="{concat('m_mo_',$optionName)}"><xsl:value-of select="./*[local-name()='value']"/></param>
  242. </xsl:template>
  243. <!--
  244. outputFormat
  245. -->
  246. <xsl:template match="*[./*[local-name()='name' and . = 'outputFormat']]">
  247. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  248. <xsl:variable name="AllowPDF"><xsl:if test="/root/capabilities and not(/root/capabilities/canGeneratePDFOutput)">false</xsl:if></xsl:variable>
  249. <xsl:variable name="AllowXML"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateXMLOutput)">false</xsl:if></xsl:variable>
  250. <xsl:variable name="AllowCSV"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateCSVOutput)">false</xsl:if></xsl:variable>
  251. <xsl:variable name="AllowXLS"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateXLSOutput)">false</xsl:if></xsl:variable>
  252. <xsl:choose>
  253. <xsl:when test="/root/basicOptions = 'true'">
  254. <param name="m_ro_outputFormat"><xsl:value-of select="./*[local-name()='value']/*[local-name()='item'][1]"/></param>
  255. </xsl:when>
  256. <xsl:otherwise>
  257. <xsl:for-each select="./*[local-name()='value']/*[local-name()='item']">
  258. <xsl:choose>
  259. <xsl:when test="contains(., 'HTML')">
  260. <param name="{concat('m_ro_',$optionName,'_HTML')}"><xsl:value-of select="."/></param>
  261. <param name="m_ro_outputF_HTML_Type">true</param>
  262. </xsl:when>
  263. <xsl:when test="contains(., 'XLS') and $AllowXLS != 'false'">
  264. <param name="{concat('m_ro_',$optionName,'_XLS2000')}"><xsl:value-of select="."/></param>
  265. <param name="m_ro_outputF_XLS2000_Type">true</param>
  266. </xsl:when>
  267. <xsl:when test="/root/allowRestrictedDefaults='true'">
  268. <param name="{concat('m_ro_',$optionName,'_',.)}"><xsl:value-of select="."/></param>
  269. </xsl:when>
  270. <xsl:when test="contains(., 'PDF') and $AllowPDF != 'false'">
  271. <param name="{concat('m_ro_',$optionName,'_',.)}"><xsl:value-of select="."/></param>
  272. </xsl:when>
  273. <xsl:when test="contains(., 'XML') and $AllowXML != 'false'">
  274. <param name="{concat('m_ro_',$optionName,'_',.)}"><xsl:value-of select="."/></param>
  275. </xsl:when>
  276. <xsl:when test="contains(., 'CSV') and $AllowCSV != 'false'">
  277. <param name="{concat('m_ro_',$optionName,'_',.)}"><xsl:value-of select="."/></param>
  278. </xsl:when>
  279. <xsl:when test="((contains(., 'spreadsheet') or contains(., 'xlsxData') or contains(., 'XLWA')) and $AllowXLS != 'false')">
  280. <param name="{concat('m_ro_',$optionName,'_',.)}"><xsl:value-of select="."/></param>
  281. </xsl:when>
  282. <xsl:otherwise></xsl:otherwise>
  283. </xsl:choose>
  284. </xsl:for-each>
  285. </xsl:otherwise>
  286. </xsl:choose>
  287. </xsl:template>
  288. <!--
  289. outputLocale
  290. -->
  291. <xsl:template match="*[./*[local-name()='name' and . = 'outputLocale']]">
  292. <xsl:variable name="jobStepClass" select="../../../obj/*/*[local-name()='objectClass']"/>
  293. <xsl:variable name="optionType" select="@xsi:type"/>
  294. <xsl:variable name="isJobDefinition" select="../../../jobDefinition='true'"/>
  295. <xsl:variable name="isPowerPlayJobStep" select="(not($isJobDefinition) and ($jobStepClass='powerPlay8Report' or $jobStepClass='powerPlay8ReportView'))"/>
  296. <xsl:variable name="isJobDefinitionWithPowerPlayOption" select="($isJobDefinition and $optionType='bus:powerPlay8OptionLanguageArray')"/>
  297. <xsl:variable name="isPowerPlayJobStepWithReportOption" select="($isPowerPlayJobStep and $optionType='bus:runOptionLanguageArray')"/>
  298. <xsl:variable name="isReportJobStepWithPowerPlayOption" select="(not($isPowerPlayJobStep) and $optionType='bus:powerPlay8OptionLanguageArray')"/>
  299. <xsl:if test="not(($isJobDefinitionWithPowerPlayOption) or ($isPowerPlayJobStepWithReportOption) or ($isReportJobStepWithPowerPlayOption))">
  300. <xsl:for-each select="./*[local-name()='value']/*[local-name()='item']">
  301. <param name="m_ro_outputLocale"><xsl:value-of select="."/></param>
  302. </xsl:for-each>
  303. </xsl:if>
  304. </xsl:template>
  305. <!--
  306. saveAs runoption
  307. -->
  308. <xsl:template match="*[./*[local-name()='name' and . = 'saveAs']]">
  309. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  310. <param name="saveAs">true</param>
  311. <param name="m_ro_saveAsType"><xsl:value-of select="./*[local-name()='objectClass']"/></param>
  312. <param name="m_ro_saveAsName"><xsl:value-of select="./*[local-name()='objectName']/*[local-name()='item'][1]/*[local-name()='value']"/></param>
  313. <param name="m_ro_saveAsPath"><xsl:value-of select="./*[local-name()='parentSearchPath']"/></param>
  314. <param name="save_how">new_entry</param>
  315. </xsl:template>
  316. <!--
  317. content task repairSecurityReferences and repairInternalInconsistencies
  318. -->
  319. <xsl:template match="*[./*[local-name()='name' and (. = 'repairSecurityReferences' or . = 'repairInternalInconsistencies')] ]">
  320. <xsl:if test="./*[local-name()='value' and . = 'true']">
  321. <param name="ctro_runoption"><xsl:value-of select="'fix'"/></param>
  322. </xsl:if>
  323. </xsl:template>
  324. <!--
  325. deployment upgrade
  326. -->
  327. <xsl:template match="*[./*[local-name()='name' and . = 'upgradeClasses'] ]">
  328. <xsl:choose>
  329. <xsl:when test="./*[local-name()='value' and . != '']">
  330. <param name="deploymentro_upgrade"><xsl:value-of select="'upgrade'"/></param>
  331. </xsl:when>
  332. <xsl:otherwise>
  333. <param name="deploymentro_upgrade"><xsl:value-of select="'keep'"/></param>
  334. </xsl:otherwise>
  335. </xsl:choose>
  336. </xsl:template>
  337. <!--
  338. deployment preserveStoreIDs
  339. -->
  340. <xsl:template match="*[./*[local-name()='name' and . = 'preserveStoreIDs'] ]">
  341. <xsl:choose>
  342. <xsl:when test="./*[local-name()='value' and . != '']">
  343. <param name="deploymentro_preserveStoreIDs"><xsl:value-of select="./*[local-name()='value']"/></param>
  344. </xsl:when>
  345. <xsl:otherwise>
  346. <param name="deploymentro_preserveStoreIDs"><xsl:value-of select="'false'"/></param>
  347. </xsl:otherwise>
  348. </xsl:choose>
  349. </xsl:template>
  350. <!-- catch all template for run options that are simple types i.e. the value element contains no sub-elements -->
  351. <xsl:template match="*[@xsi:type != '']" priority="-1">
  352. <xsl:variable name="optionName" select="./*[local-name()='name']"/>
  353. <xsl:if test="$optionName != '' and not(./*[local-name()='value']/*)">
  354. <param name="{concat('m_ro_',$optionName)}"><xsl:value-of select="./*[local-name()='value']"/></param>
  355. </xsl:if>
  356. </xsl:template>
  357. <!--
  358. generate the defaults for format and locale using the values saved on the report object or the preferences
  359. -->
  360. <xsl:template name="generateDefaults">
  361. <!--
  362. if we don't have an outputFormat, that means that no runOptions were saved. Default anything that
  363. we can using the options from the report or user preferences
  364. -->
  365. <xsl:if test="not(/root/*[local-name()='options']/*[local-name()='value']/*[local-name()='item' and ./*[local-name()='name'] = 'outputFormat'])">
  366. <!-- process all the options that were saved on the runnable -->
  367. <xsl:if test="/root/reportOptions/* != ''">
  368. <xsl:call-template name="processOptions">
  369. <xsl:with-param name="options" select="/root/reportOptions/*[local-name()='options']/*[local-name()='value']/*[local-name()='item']"/>
  370. </xsl:call-template>
  371. </xsl:if>
  372. <!-- last resort, use user preferences for format and locale if the runnable didn't have a outputFormat saved -->
  373. <xsl:if test="not(/root/reportOptions/options/value/item/name[. = 'outputFormat']) and (not(/root/optionList) or (/root/optionList[@include = 'true'] and key('option-list','outputFormat')))">
  374. <xsl:variable name="actualFormat">
  375. <xsl:value-of select="/root/*[local-name()='preferences']/*[local-name()='item' and ./*[local-name()='name']='format']/*[local-name()='value']"/>
  376. </xsl:variable>
  377. <xsl:variable name="allowPDF"><xsl:if test="/root/capabilities and not(/root/capabilities/canGeneratePDFOutput)">false</xsl:if></xsl:variable>
  378. <xsl:variable name="allowXML"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateXMLOutput)">false</xsl:if></xsl:variable>
  379. <xsl:variable name="allowCSV"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateCSVOutput)">false</xsl:if></xsl:variable>
  380. <xsl:variable name="allowXLS"><xsl:if test="/root/capabilities and not(/root/capabilities/canGenerateXLSOutput)">false</xsl:if></xsl:variable>
  381. <xsl:variable name="defaultFormat">
  382. <xsl:choose>
  383. <!-- These first conditions will allow to check if the format from the preferences is available in the system -->
  384. <xsl:when test="contains($actualFormat, 'HTML') and key('system-param', 'reportFormats')/format[@id='HTML']"><xsl:value-of select="'HTML'"/></xsl:when>
  385. <xsl:when test="contains($actualFormat, 'XHTML') and key('system-param', 'reportFormats')/format[@id='XHTML']"><xsl:value-of select="'XHTML'"/></xsl:when>
  386. <xsl:when test="contains($actualFormat, 'HTMLFragment') and key('system-param', 'reportFormats')/format[@id='HTMLFragment']"><xsl:value-of select="'HTMLFragment'"/></xsl:when>
  387. <xsl:when test="contains($actualFormat, 'PDF') and key('system-param', 'reportFormats')/format[@id='PDF'] and not($allowPDF='false')"><xsl:value-of select="'PDF'"/></xsl:when>
  388. <xsl:when test="contains($actualFormat, 'spreadsheetML') and key('system-param', 'reportFormats')/format[@id='spreadsheetML'] and not($allowXLS='false')"><xsl:value-of select="'spreadsheetML'"/></xsl:when>
  389. <xsl:when test="contains($actualFormat, 'xlsxData') and key('system-param', 'reportFormats')/format[@id='xlsxData'] and not($allowXLS='false')"><xsl:value-of select="'xlsxData'"/></xsl:when>
  390. <xsl:when test="contains($actualFormat, 'spreadsheetMLOfficeConnectionEnabled') and key('system-param', 'reportFormats')/format[@id='spreadsheetMLOfficeConnectionEnabled']"><xsl:value-of select="'spreadsheetMLOfficeConnectionEnabled'"/></xsl:when>
  391. <xsl:when test="contains($actualFormat, 'singleXLS') and key('system-param', 'reportFormats')/format[@id='singleXLS'] and not($allowXLS='false')"><xsl:value-of select="'singleXLS'"/></xsl:when>
  392. <xsl:when test="contains($actualFormat, 'XLWA') and key('system-param', 'reportFormats')/format[@id='XLWA'] and not($allowXLS='false')"><xsl:value-of select="'XLWA'"/></xsl:when>
  393. <xsl:when test="contains($actualFormat, 'XLS') and key('system-param', 'reportFormats')/format[@id='XLS'] and not($allowXLS='false')"><xsl:value-of select="'XLS'"/></xsl:when>
  394. <xsl:when test="contains($actualFormat, 'CSV') and key('system-param', 'reportFormats')/format[@id='CSV'] and not($allowCSV='false')"><xsl:value-of select="'CSV'"/></xsl:when>
  395. <xsl:when test="contains($actualFormat, 'XML') and key('system-param', 'reportFormats')/format[@id='XML'] and not($allowXML='false')"><xsl:value-of select="'XML'"/></xsl:when>
  396. <!-- Now from here. The preferences format is not available. So get the first one from the system param-->
  397. <xsl:when test="key('system-param', 'reportFormats')/format[@id='HTML']"><xsl:value-of select="'HTML'"/></xsl:when>
  398. <xsl:when test="key('system-param', 'reportFormats')/format[@id='XHTML']"><xsl:value-of select="'XHTML'"/></xsl:when>
  399. <xsl:when test="key('system-param', 'reportFormats')/format[@id='HTMLFragment']"><xsl:value-of select="'HTMLFragment'"/></xsl:when>
  400. <xsl:when test="key('system-param', 'reportFormats')/format[@id='PDF']"><xsl:value-of select="'PDF'"/></xsl:when>
  401. <xsl:when test="key('system-param', 'reportFormats')/format[@id='spreadsheetML']"><xsl:value-of select="'spreadsheetML'"/></xsl:when>
  402. <xsl:when test="key('system-param', 'reportFormats')/format[@id='xlsxData']"><xsl:value-of select="'xlsxData'"/></xsl:when>
  403. <xsl:when test="key('system-param', 'reportFormats')/format[@id='spreadsheetMLOfficeConnectionEnabled']"><xsl:value-of select="'spreadsheetMLOfficeConnectionEnabled'"/></xsl:when>
  404. <xsl:when test="key('system-param', 'reportFormats')/format[@id='singleXLS']"><xsl:value-of select="'singleXLS'"/></xsl:when>
  405. <xsl:when test="key('system-param', 'reportFormats')/format[@id='XLWA']"><xsl:value-of select="'XLWA'"/></xsl:when>
  406. <xsl:when test="key('system-param', 'reportFormats')/format[@id='XLS']"><xsl:value-of select="'XLS'"/></xsl:when>
  407. <xsl:when test="key('system-param', 'reportFormats')/format[@id='CSV']"><xsl:value-of select="'CSV'"/></xsl:when>
  408. <xsl:when test="key('system-param', 'reportFormats')/format[@id='XML']"><xsl:value-of select="'XML'"/></xsl:when>
  409. <xsl:otherwise><xsl:value-of select="$actualFormat"/></xsl:otherwise>
  410. </xsl:choose>
  411. </xsl:variable>
  412. <!-- do we actually have a format to default to -->
  413. <xsl:if test="$defaultFormat != ''">
  414. <xsl:choose>
  415. <!-- if we're in the report property dialog, then take the first format from the options -->
  416. <xsl:when test="/root/basicOptions = 'true'">
  417. <param name="m_ro_outputFormat"><xsl:value-of select="$defaultFormat"/></param>
  418. </xsl:when>
  419. <xsl:otherwise>
  420. <xsl:choose>
  421. <xsl:when test="contains($defaultFormat, 'HTML') and not(/root/env/param[@name='m_ro_outputFormat_HTML'])">
  422. <param name="m_ro_outputFormat_HTML"><xsl:value-of select="$defaultFormat"/></param>
  423. <param name="m_ro_outputF_HTML_Type">true</param>
  424. </xsl:when>
  425. <xsl:when test="contains(., 'XLS') and xtsext:cafaction('get_configsignedreporturls', '') = 'false'">
  426. <param name="m_ro_outputFormat_XLS2000"><xsl:value-of select="$defaultFormat"/></param>
  427. <param name="m_ro_outputF_XLS2000_Type">true</param>
  428. </xsl:when>
  429. <xsl:when test="$defaultFormat = 'singleXLS'">
  430. <param name="m_ro_outputFormat_XLS2000"><xsl:value-of select="$defaultFormat"/></param>
  431. <param name="m_ro_outputFormat_singleXLS"><xsl:value-of select="$defaultFormat"/></param>
  432. <param name="m_ro_outputF_XLS2000_Type">true</param>
  433. </xsl:when>
  434. <xsl:when test="not(contains(., 'XLS'))">
  435. <param name="{concat('m_ro_outputFormat_',$defaultFormat)}"><xsl:value-of select="$defaultFormat"/></param>
  436. </xsl:when>
  437. </xsl:choose>
  438. </xsl:otherwise>
  439. </xsl:choose>
  440. </xsl:if>
  441. </xsl:if>
  442. <!-- if the runnable didn't have outputLocale saved, then try to get if from the preferences -->
  443. <xsl:if test="not(/root/reportOptions/options/value/item/name[. = 'outputLocale']) and (not(/root/optionList) or (/root/optionList[@include = 'true'] and key('option-list','outputLocale')))">
  444. <!-- outputLocale -->
  445. <xsl:if test="/root/*[local-name()='preferences']/*[local-name()='item' and ./*[local-name()='name']='contentLocale']/*[local-name()='value'] != ''">
  446. <param name="m_ro_outputLocale"><xsl:value-of select="/root/*[local-name()='preferences']/*[local-name()='item' and ./*[local-name()='name']='contentLocale']/*[local-name()='value']"/></param>
  447. </xsl:if>
  448. </xsl:if>
  449. <!-- if the runnable didn't have a11y option saved, then try to get if from the preferences or service defaults -->
  450. <xsl:variable name="a11yOptionName" select="'http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures'"/>
  451. <xsl:if test="not(/root/reportOptions/options/value/item/name[. = $a11yOptionName]) and (not(/root/optionList) or (/root/optionList[@include = 'true'] and key('option-list', $a11yOptionName)))">
  452. <!-- accessibilityFeatures -->
  453. <xsl:choose>
  454. <xsl:when test="/root/*[local-name()='preferences']/*[local-name()='item' and ./*[local-name()='name']=$a11yOptionName]/*[local-name()='value'] != ''">
  455. <param name="m_go_accessibilityFeatures">
  456. <xsl:value-of select="/root/*[local-name()='preferences']/*[local-name()='item' and ./*[local-name()='name']=$a11yOptionName]/*[local-name()='value']"/>
  457. </param>
  458. </xsl:when>
  459. <xsl:when test="/root/*[local-name()='serviceDefaults']/*/*[local-name()='item' and ./*[local-name()='name']=$a11yOptionName]/*[local-name()='value'] != ''">
  460. <param name="m_go_accessibilityFeatures">
  461. <xsl:value-of select="/root/*[local-name()='serviceDefaults']/*/*[local-name()='item' and ./*[local-name()='name']=$a11yOptionName]/*[local-name()='value']"/>
  462. </param>
  463. </xsl:when>
  464. </xsl:choose>
  465. </xsl:if>
  466. </xsl:if>
  467. </xsl:template>
  468. <xsl:template match="text()" priority="0"/>
  469. </xsl:stylesheet>