get2post.xsl 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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, 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. <!-- This stylesheet defines global portal variables and templates. -->
  13. <xsl:stylesheet version="1.0"
  14. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  15. xmlns:out="dummy-uri"
  16. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. xmlns:gp="http://developer.cognos.com/schemas/xts/gp"
  19. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  20. exclude-result-prefixes="xsl xtsext xts gp cm">
  21. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  22. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  23. <!--
  24. Template - gp:getToPostConversion
  25. This template generates a template used to convert a chuck of xml into an xml-encoded string.
  26. Operation:
  27. Outputs the serialize-xml template.
  28. -->
  29. <xsl:template match="gp:getToPostConversion">
  30. <out:template name="getToPostConversion">
  31. <out:param name="arguments" select="''"/>
  32. <input type="hidden">
  33. <out:variable name="name">
  34. <out:value-of select="string(xtsext:urldecode(substring-before($arguments, '=')))"/>
  35. </out:variable>
  36. <out:variable name="argumentsLessName">
  37. <out:value-of select="substring-after($arguments, '=')"/>
  38. </out:variable>
  39. <out:choose>
  40. <out:when test="contains($argumentsLessName, '&amp;')">
  41. <out:variable name="value">
  42. <out:value-of select="string(xtsext:urldecode(substring-before($argumentsLessName, '&amp;')))"/>
  43. </out:variable>
  44. <out:attribute name="name"><out:value-of select="$name"/></out:attribute>
  45. <out:attribute name="value"><out:value-of select="$value"/></out:attribute>
  46. </out:when>
  47. <out:otherwise>
  48. <out:variable name="value">
  49. <out:value-of select="string(xtsext:urldecode(string($argumentsLessName)))"/>
  50. </out:variable>
  51. <out:attribute name="name"><out:value-of select="$name"/></out:attribute>
  52. <out:attribute name="value"><out:value-of select="$value"/></out:attribute>
  53. </out:otherwise>
  54. </out:choose>
  55. </input>
  56. <out:variable name="argumentsStripped">
  57. <out:value-of select="substring-after($arguments, '&amp;')"/>
  58. </out:variable>
  59. <out:if test="contains($arguments, '&amp;')">
  60. <out:call-template name="getToPostConversion">
  61. <out:with-param name="arguments">
  62. <out:value-of select="$argumentsStripped"/>
  63. </out:with-param>
  64. </out:call-template>
  65. </out:if>
  66. </out:template>
  67. </xsl:template>
  68. <xsl:template match="*">
  69. <xsl:copy>
  70. <xsl:copy-of select="@*"/>
  71. <xsl:apply-templates/>
  72. </xsl:copy>
  73. </xsl:template>
  74. </xsl:stylesheet>