display_markup_page.xslt 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2008
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Transform that takes markup and produces an HTML page
  10. The input to the transform should be the following
  11. <root>
  12. <morphletResponse>
  13. <markup>Markup to be displayed</markup>
  14. <browserTitle>Title for the browser</browserTitle>
  15. <request_stack_0>stack information that will get added as hidden inputs</request_stack_0>
  16. ...
  17. <request_stack_x>stack information</request_stack_x>
  18. </morphletResponse>
  19. <env>
  20. ...
  21. </env>
  22. <system>
  23. ...
  24. </system>
  25. <http>
  26. ...
  27. </http>
  28. </root>
  29. -->
  30. <xsl:stylesheet version="1.0"
  31. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  32. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  33. exclude-result-prefixes="xsl xts">
  34. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  35. <xsl:key name="system-param" match="/*[local-name()='root']/system/param" use="@name"/>
  36. <xsl:key name="env-param" match="/*[local-name()='root']/env/param" use="@name"/>
  37. <xsl:key name="user-param" match="/*[local-name()='root']/user/param" use="@name"/>
  38. <xsl:template match="/*[local-name()='root']/*[local-name()='morphletResponse']/*[local-name()='markup']" priority="1">
  39. <xsl:variable name="webRoot">
  40. <xsl:choose>
  41. <!-- if we have a root then use it (may be empty if the root document directory has been setup in the web browser. See 573783)-->
  42. <xsl:when test="/root/http/param[@name='WEB_CONTENT_ROOT']">
  43. <xsl:value-of select="string(/root/http/param[@name='WEB_CONTENT_ROOT'])"/>
  44. </xsl:when>
  45. <!-- No official config param is present. Make this relative. -->
  46. <xsl:otherwise>..</xsl:otherwise>
  47. </xsl:choose>
  48. </xsl:variable>
  49. <xsl:variable name="app" select="key('system-param', 'app')"/>
  50. <xsl:variable name="gateway" select="string(/root/http/param[@name='SCRIPT_NAME'])"/>
  51. <xsl:variable name="user_skin">
  52. <xsl:choose>
  53. <xsl:when test="key('user-param', 'skin') != ''">
  54. <xsl:value-of select="key('user-param', 'skin')"/>
  55. </xsl:when>
  56. <xsl:otherwise>
  57. <xsl:value-of select="key('system-param', 'defaultPortalPreferences')/pref[@name='skin']"/>
  58. </xsl:otherwise>
  59. </xsl:choose>
  60. </xsl:variable>
  61. <xsl:variable name="skin_root" select="concat($webRoot, '/skins', '/', $user_skin)"/>
  62. <xsl:variable name="skin_style" select="concat($skin_root, '/', $app, '/default.css')"/>
  63. <xsl:variable name="skin_fonts" select="concat($skin_root, '/fonts.css')"/>
  64. <!-- produce the HTML to be displayed -->
  65. <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
  66. <html>
  67. <head>
  68. <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  69. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  70. <meta name="copyright">
  71. <xsl:attribute name="content"><xts:string id="IDS_COPYRIGHT"/></xsl:attribute>
  72. </meta>
  73. <meta name="trademark">
  74. <xsl:attribute name="content"><xts:string id="IDS_TRADEMARK"/></xsl:attribute>
  75. </meta>
  76. <meta name="template">
  77. <xsl:attribute name="content"><xsl:value-of select="key('env-param', 'm')"/></xsl:attribute>
  78. </meta>
  79. <meta http-equiv="Expires" content="0"/>
  80. <title>
  81. <xsl:value-of select="../*[local-name()='browserTitle']"/>
  82. </title>
  83. <link rel="stylesheet" type="text/css">
  84. <xsl:attribute name="href">
  85. <xsl:value-of select="$skin_style"/>
  86. </xsl:attribute>
  87. </link>
  88. <link rel="stylesheet" type="text/css" href="{$skin_fonts}"/>
  89. <xsl:copy-of select="/*[local-name()='root']/*[local-name()='scripts']/*"/>
  90. </head>
  91. <body onload="if (window.init) init();" class="dialogBody">
  92. <xsl:attribute name="topmargin">3</xsl:attribute>
  93. <xsl:attribute name="bottommargin">0</xsl:attribute>
  94. <xsl:attribute name="marginheight">3</xsl:attribute>
  95. <xsl:attribute name="rightmargin">0</xsl:attribute>
  96. <xsl:attribute name="leftmargin">3</xsl:attribute>
  97. <xsl:attribute name="marginwidth">3</xsl:attribute>
  98. <form name="pform" method="post" action="{$gateway}">
  99. <xsl:apply-templates select="*" mode="copy"/>
  100. <xsl:copy-of select="/*[local-name()='root']/*[local-name()='formFields']/*"/>
  101. </form>
  102. <xsl:if test="../*[local-name()='debugDump']">
  103. <xsl:copy-of select="../*[local-name()='debugDump']"/>
  104. </xsl:if>
  105. </body>
  106. </html>
  107. </xsl:template>
  108. <xsl:template match="@*|node()[local-name() != 'form']" mode="copy">
  109. <xsl:copy>
  110. <xsl:apply-templates select="@*" mode="copy"/>
  111. <xsl:apply-templates mode="copy"/>
  112. </xsl:copy>
  113. </xsl:template>
  114. <xsl:template match="text()" priority="0"/>
  115. </xsl:stylesheet>