createHiddenVariables.xslt 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. 2012, 2016
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  9. version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/"
  10. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  11. xmlns:dpl="http://developer.cognos.com/schemas/xts/logicsheets/deployment/"
  12. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  13. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  14. exclude-result-prefixes="pf dpl cm xtsext">
  15. <xsl:output method="xml" version="1.0" encoding="UTF-8"
  16. indent="no" />
  17. <pf:variables />
  18. <dpl:variables />
  19. <xsl:template match="/root">
  20. <xts:sequence>
  21. <xsl:variable name="isExportDeployment" select="$deployment-method='export'"/>
  22. <xsl:variable name="isImportDeployment" select="$deployment-method='import'"/>
  23. <xsl:variable name="onMethodPage" select="key('env-param', 'm_deploymentWizardPage') = 'method'"/>
  24. <xsl:variable name="onPackagesPage" select="key('env-param', 'm_deploymentWizardPage') = 'packages'"/>
  25. <!--[580601] Delete the search path if we are on the deployment
  26. method page of the export wizard.. -->
  27. <xsl:if test="($isExportDeployment and $onMethodPage) or ($isImportDeployment and $onPackagesPage)">
  28. <xts:delete select="/root/env/param[@name='so.searchPath']" />
  29. </xsl:if>
  30. <xts:append select="/root/env">
  31. <xsl:for-each select="/root/cm:deploymentOptionsUI/cm:deploymentOption">
  32. <!-- Convenience variables for ease of readability -->
  33. <xsl:variable name="optionName" select="@name" />
  34. <xsl:variable name="isOptionOfInterest" select="contains(' dataSourceSignonSelect packageOutputs packageDatasetOutputs packageHistories personalDataSelect entireContentStoreSelect packageSchedules tenants ', concat(' ', $optionName, ' '))"/>
  35. <xsl:variable name="isConflictResolutionOption" select="contains($optionName, 'ConflictResolution')"/>
  36. <xsl:if test="$isOptionOfInterest or $isConflictResolutionOption">
  37. <xsl:choose>
  38. <xsl:when test="$optionName='tenants'">
  39. <xsl:for-each select="cm:value[.!='']">
  40. <xsl:variable name="tenantID" select="."/>
  41. <xsl:if test="not(key('env-param','selectedTenants')[.=$tenantID])">
  42. <param name="selectedTenants">
  43. <xsl:value-of select="$tenantID"/>
  44. </param>
  45. </xsl:if>
  46. </xsl:for-each>
  47. <xsl:if test="cm:value[.='']">
  48. <param name="selectPublicTenant">true</param>
  49. </xsl:if>
  50. </xsl:when>
  51. <xsl:otherwise>
  52. <xsl:if test="@enabled='false'">
  53. <xsl:variable name="disabledVariableName" select="concat('m_disabled_',$optionName)" />
  54. <xsl:if test="not(key('env-param',$disabledVariableName))">
  55. <param name="{$disabledVariableName}"/>
  56. </xsl:if>
  57. </xsl:if>
  58. <xsl:variable name="lastValueVariableName" select="concat('m_last_value_',$optionName)" />
  59. <xsl:variable name="lastValue" select="."/>
  60. <xsl:if test="not(key('env-param',$lastValueVariableName))">
  61. <param name="{$lastValueVariableName}">
  62. <xsl:value-of select="$lastValue" />
  63. </param>
  64. </xsl:if>
  65. </xsl:otherwise>
  66. </xsl:choose>
  67. </xsl:if>
  68. </xsl:for-each>
  69. <!-- add hidden variables for personalDataSelect and entireContentStoreSelect -->
  70. <xsl:choose>
  71. <xsl:when test="$isExportDeployment and not(/root/cm:deploymentOptionsUI)">
  72. <xsl:if test="not(key('env-param','m_last_value_personalDataSelect'))">
  73. <param name="m_last_value_personalDataSelect">
  74. <xsl:choose>
  75. <xsl:when test="key('env-param','m_personalDataSelect')">true</xsl:when>
  76. <xsl:otherwise>false</xsl:otherwise>
  77. </xsl:choose>
  78. </param>
  79. </xsl:if>
  80. <xsl:if test="not(key('env-param','m_last_value_entireContentStoreSelect'))">
  81. <param name="m_last_value_entireContentStoreSelect">
  82. <xsl:choose>
  83. <xsl:when test="key('env-param','m_entireContentStoreSelect')">
  84. <xsl:value-of select="key('env-param','m_entireContentStoreSelect')" />
  85. </xsl:when>
  86. <xsl:otherwise>false</xsl:otherwise>
  87. </xsl:choose>
  88. </param>
  89. </xsl:if>
  90. </xsl:when>
  91. <xsl:when test="$isImportDeployment and not(/root/cm:deploymentOptionsUI) and /root/archiveOptions">
  92. <xsl:if test="not(key('env-param','m_last_value_personalDataSelect'))">
  93. <param name="m_last_value_personalDataSelect">
  94. <xsl:value-of select="/root/archiveOptions/cm:getDeploymentOptionsResponse/cm:deploymentOptions/cm:deploymentOption[@name='personalDataSelect']" />
  95. </param>
  96. </xsl:if>
  97. <xsl:if test="not(key('env-param','m_last_value_entireContentStoreSelect'))">
  98. <param name="m_last_value_entireContentStoreSelect">
  99. <xsl:value-of select="/root/archiveOptions/cm:getDeploymentOptionsResponse/cm:deploymentOptions/cm:deploymentOption[@name='entireContentStoreSelect']" />
  100. </param>
  101. </xsl:if>
  102. </xsl:when>
  103. </xsl:choose>
  104. </xts:append>
  105. <!-- Add hidden variable for export method -->
  106. <xsl:if test="not(key('env-param','m_exportMethod'))">
  107. <xsl:variable name="entireContentStoreOption" select="/root/cm:deploymentOptionsUI/cm:deploymentOption[@name='entireContentStoreSelect']"/>
  108. <xsl:variable name="personalDataSelectOption" select="/root/cm:deploymentOptionsUI/cm:deploymentOption[@name='personalDataSelect']"/>
  109. <xsl:variable name="entireContentStoreEnvParam" select="key('env-param','m_entireContentStoreSelect') or $entireContentStoreOption='true'"/>
  110. <xsl:variable name="personalDataSelectParam" select="key('env-param','m_personalDataSelect') or $personalDataSelectOption='true'"/>
  111. <xsl:variable name="isEntireContentStoreMethod" select="$entireContentStoreEnvParam='true' or (not($entireContentStoreEnvParam) and $entireContentStoreOption='true')"/>
  112. <xsl:variable name="hasTenants" select="count(/root/cm:deploymentOptionsUI/cm:deploymentOption[@name='tenants']/*) > 0"/>
  113. <xts:append select="/root/env">
  114. <xsl:choose>
  115. <xsl:when test="$isEntireContentStoreMethod and not($hasTenants)">
  116. <param name="m_exportMethod">entireContentStore</param>
  117. <param name="m_entireContentStoreSelect">true</param>
  118. <param name="m_personalDataSelect"><xsl:value-of select="$personalDataSelectParam"/></param>
  119. </xsl:when>
  120. <xsl:when test="$isEntireContentStoreMethod and $hasTenants">
  121. <param name="m_exportMethod">selectTenants</param>
  122. <param name="m_entireContentStoreSelect">true</param>
  123. <param name="m_personalDataSelect"><xsl:value-of select="$personalDataSelectParam"/></param>
  124. </xsl:when>
  125. <xsl:otherwise>
  126. <param name="m_exportMethod">selectContent</param>
  127. <param name="m_entireContentStoreSelect">false</param>
  128. <param name="m_personalDataSelect">false</param>
  129. </xsl:otherwise>
  130. </xsl:choose>
  131. </xts:append>
  132. </xsl:if>
  133. </xts:sequence>
  134. </xsl:template>
  135. </xsl:stylesheet>