interaction.xslt 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  13. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  14. <xsl:variable name="config" select="/root/input[@name='configurationResponse']/config/param[@name='contentLocales']"/>
  15. <xsl:template match="/">
  16. <response>
  17. <fragment>
  18. <xsl:if test="/root/interactions/param[@name='formaction']='view' or /root/interactions/param[@name='formaction']='save' or /root/interactions/param[@name='formaction']='cancel'">
  19. <xsl:if test="/root/interactions/param[@name='formaction']!='view'">
  20. <newMode>view</newMode>
  21. </xsl:if>
  22. </xsl:if>
  23. </fragment>
  24. <xsl:if test="/root/interactions/param[@name='formaction']='save' and /root/controllerParams/param[@name='frag-mode']='edit'">
  25. <customs>
  26. <xsl:for-each select="/root/fragment/meta/customProperties">
  27. <xsl:choose>
  28. <xsl:when test="not(@name='LocaleSelect')">
  29. <xsl:variable name="cpName" select="@name"/>
  30. <param name="{$cpName}">
  31. <xsl:for-each select="$config/locale">
  32. <xsl:variable name="lid" select="@id"/>
  33. <xsl:for-each select="/root/interactions/param[@name = concat($cpName,'-',$lid)]">
  34. <xsl:if test="not(contains(string(/root/interactions/param[@name='removeLang']),concat($lid,';')))">
  35. <value xml:lang="{$lid}"><xsl:value-of select="string(.)"/></value>
  36. </xsl:if>
  37. </xsl:for-each>
  38. </xsl:for-each>
  39. </param>
  40. </xsl:when>
  41. <xsl:otherwise>
  42. <param name="LocaleSelect"><xsl:value-of select="/root/customs/param[@name='LocaleSelect']"/></param>
  43. </xsl:otherwise>
  44. </xsl:choose>
  45. </xsl:for-each>
  46. </customs>
  47. </xsl:if>
  48. </response>
  49. </xsl:template>
  50. <xsl:template match="param" mode="state">
  51. <xsl:if test="/root/input[@name='stateParams']/stateParams/param[@name=current()/@name]">
  52. <xsl:copy-of select="."/>
  53. </xsl:if>
  54. </xsl:template>
  55. </xsl:stylesheet>