uiobjects_runnables.xslt 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  5. (C) Copyright IBM Corp. 2005, 2010
  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. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  15. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  16. xmlns:nox="http://developer.cognos.com/schemas/navomx/1/"
  17. exclude-result-prefixes="xtsext xts xsl">
  18. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  19. <xsl:key name="uiExtensions-class" match="/xts:block/nox:uiMetadata/nox:classes/nox:class" use="nox:name"/>
  20. <!--
  21. TODO: In order to remove all this special case logic we need to move icon generation to runtime.
  22. -->
  23. <xsl:variable name="viewMap">
  24. <map>
  25. <mapEntry>
  26. <key>reportView</key>
  27. <value>report</value>
  28. </mapEntry>
  29. <mapEntry>
  30. <key>dataMovementTaskAlias</key>
  31. <value>dataMovementTask</value>
  32. </mapEntry>
  33. <mapEntry>
  34. <key>powerPlay8ReportView</key>
  35. <value>powerPlay8Report</value>
  36. </mapEntry>
  37. <mapEntry>
  38. <key>agentDefinitionView</key>
  39. <value>agentDefinition</value>
  40. </mapEntry>
  41. </map>
  42. </xsl:variable>
  43. <xsl:template match="/">
  44. <xsl:element name="xts:block">
  45. <xsl:copy-of select="xts:block/@*"/>
  46. <xsl:element name="runnables">
  47. <xsl:for-each select="xts:block/nox:uiMetadata/nox:classes/nox:class[nox:runnable = 'true']">
  48. <xsl:sort select="nox:name" order="ascending"/>
  49. <xsl:variable name="className"><xsl:value-of select="nox:name"/></xsl:variable>
  50. <xsl:element name="class">
  51. <xsl:attribute name="name"><xsl:value-of select="$className"/></xsl:attribute>
  52. <xsl:if test="nox:canRunInteractive != ''">
  53. <xsl:attribute name="isInteractive"><xsl:value-of select="nox:canRunInteractive"/></xsl:attribute>
  54. </xsl:if>
  55. <xsl:if test="nox:canRunBatch != ''">
  56. <xsl:attribute name="isBackground"><xsl:value-of select="nox:canRunBatch"/></xsl:attribute>
  57. </xsl:if>
  58. <xsl:if test="nox:idsString and nox:idsString!=''">
  59. <xsl:element name="displayName">
  60. <xsl:element name="xts:string">
  61. <xsl:attribute name="id"><xsl:value-of select="nox:idsString"/></xsl:attribute>
  62. </xsl:element>
  63. </xsl:element>
  64. </xsl:if>
  65. <xsl:variable name="mapEntry" select="$viewMap/map/mapEntry[key=$className]"/>
  66. <xsl:variable name="resolvedClass">
  67. <xsl:choose>
  68. <xsl:when test="$mapEntry != ''">
  69. <xsl:value-of select="$mapEntry/value"/>
  70. </xsl:when>
  71. <xsl:otherwise>
  72. <xsl:value-of select="$className"/>
  73. </xsl:otherwise>
  74. </xsl:choose>
  75. </xsl:variable>
  76. <xsl:variable name="baseIcon">
  77. <xsl:choose>
  78. <xsl:when test="key('uiExtensions-class', string($resolvedClass))/nox:icon != ''"><xsl:value-of select="key('uiExtensions-class', string($resolvedClass))/nox:icon"/></xsl:when>
  79. <xsl:otherwise><xsl:value-of select="key('uiExtensions-class', string($resolvedClass))/nox:imgTool/nox:param[nox:name='icon']/nox:value"/></xsl:otherwise>
  80. </xsl:choose>
  81. </xsl:variable>
  82. <xsl:variable name="suffix">
  83. <xsl:value-of select="nox:imgTool/nox:param[nox:name='suffix']/nox:value"/>
  84. </xsl:variable>
  85. <xsl:element name="icon">
  86. <xsl:value-of select="concat('icon_',$baseIcon, $suffix,'.gif')"/>
  87. </xsl:element>
  88. <xsl:element name="root">
  89. <xsl:value-of select="nox:root/nox:path"/>
  90. </xsl:element>
  91. </xsl:element>
  92. </xsl:for-each>
  93. </xsl:element>
  94. </xsl:element>
  95. </xsl:template>
  96. </xsl:stylesheet>