interaction.xslt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  5. (C) Copyright IBM Corp. 2005, 2011
  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. <!--
  15. the following imports requires these variables to be defined:
  16. $metaData, $interactions, $logic, $userPreferences, $navRequest, $navResponse
  17. -->
  18. <xsl:import href="/common/propeditor/types/xsdtypes.xslt"/>
  19. <xsl:import href="/common/propeditor/types/fragextTypes.xslt"/>
  20. <xsl:import href="/common/propeditor/types/cmtypes.xslt"/>
  21. <xsl:import href="/common/propeditor/types/cmmtypes.xslt"/>
  22. <xsl:import href="/common/propeditor/types/generictypes.xslt"/>
  23. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  24. <!--
  25. Variable declarations. The xpath "/*[false()]" provides an empty node set result.
  26. -->
  27. <xsl:variable name="metaData" select="/root/fragment/meta"/>
  28. <xsl:variable name="interactions" select="/root/interactions"/>
  29. <xsl:variable name="state" select="/root/state"/>
  30. <xsl:variable name="userPreferences" select="/*[false()]"/>
  31. <xsl:variable name="logic" select="/*[false()]"/>
  32. <xsl:variable name="navRequest" select="/*[false()]"/>
  33. <xsl:variable name="navResponse" select="/*[false()]"/>
  34. <xsl:template match="/">
  35. <response>
  36. <xsl:choose>
  37. <xsl:when test="$interactions/param[@name='privateAction'] = 'save'">
  38. <fragment>
  39. <!-- restore previous state -->
  40. <state><xsl:value-of select="/root/state/param[@name='frag_prev_state']"/></state>
  41. </fragment>
  42. <customs>
  43. <xsl:for-each select="$metaData/customProperties[string(control/@appearance)!='hidden']">
  44. <xsl:variable name="currentPropertyName" select="@name"/>
  45. <param name="{@name}">
  46. <xsl:apply-templates select="." mode="interaction-save"/>
  47. </param>
  48. </xsl:for-each>
  49. </customs>
  50. </xsl:when>
  51. <xsl:when test="$interactions/param[@name='privateAction'] = 'cancel'">
  52. <fragment>
  53. <!-- restore previous state -->
  54. <state><xsl:value-of select="/root/state/param[@name='frag_prev_state']"/></state>
  55. </fragment>
  56. </xsl:when>
  57. <xsl:otherwise>
  58. <state>
  59. <!-- Keep a copy of the view mode fragment state -->
  60. <xsl:if test="not(/root/state/param[@name='frag_prev_state'])">
  61. <param name="frag_prev_state"><xsl:value-of select="/root/controllerParams/param[@name='frag-state']"/></param>
  62. </xsl:if>
  63. <xsl:copy-of select="/root/state/param[not(@name = $interactions/param/@name)]"/>
  64. <xsl:apply-templates select="$metaData/customProperties" mode="interaction-state"/>
  65. </state>
  66. </xsl:otherwise>
  67. </xsl:choose>
  68. </response>
  69. </xsl:template>
  70. <!-- these are templates required by the markup stage -->
  71. <xsl:template name="getPropertyValue"/>
  72. <xsl:template name="relatedControl"/>
  73. <xsl:template name="keyScript"/>
  74. <xsl:template name="createLanguageSelector"/>
  75. <xsl:template match="customProperties" mode="interaction-state">
  76. <xsl:variable name="prefix" select="substring-before(datatype, ':')"/>
  77. <xsl:variable name="type" select="substring-after(datatype, ':')"/>
  78. <xsl:variable name="namespaceSpecificCustomProps">
  79. <xsl:element name="{$prefix}:{$type}" namespace="{datatype/namespace::*[name() = $prefix]}">
  80. <xsl:copy-of select="self::node()"/>
  81. </xsl:element>
  82. </xsl:variable>
  83. <xsl:apply-templates select="$namespaceSpecificCustomProps/*" mode="interactions"/>
  84. </xsl:template>
  85. <xsl:template match="customProperties" mode="interaction-save">
  86. <xsl:variable name="prefix" select="substring-before(datatype, ':')"/>
  87. <xsl:variable name="type" select="substring-after(datatype, ':')"/>
  88. <xsl:variable name="namespaceSpecificCustomProps">
  89. <xsl:element name="{$prefix}:{$type}" namespace="{datatype/namespace::*[name() = $prefix]}">
  90. <xsl:copy-of select="self::node()"/>
  91. </xsl:element>
  92. </xsl:variable>
  93. <xsl:apply-templates select="$namespaceSpecificCustomProps/*" mode="save"/>
  94. </xsl:template>
  95. </xsl:stylesheet>
  96. <!-- $Header: //cpscrn/main/src/java/etc/webapps/cps/WEB-INF/fragments/producers/common/propeditor/interaction.xslt#1 $ -->
  97. <!-- $DateTime: 2008/10/22 11:12:04 $ -->
  98. <!-- $Change: 25109 $ -->