display_markup.xslt 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Licensed Materials - Property of IBM IBM Cognos Products: ps (C) Copyright
  3. IBM Corp. 2005, 2011 US Government Users Restricted Rights - Use, duplication
  4. or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. -->
  5. <!-- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  6. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated). -->
  7. <!-- Transform that takes markup and produces an HTML page The input to the
  8. transform should be the following <root> <morphletResponse> <markup>Markup
  9. to be displayed</markup> <browserTitle>Title for the browser</browserTitle>
  10. <request_stack_0>stack information that will get added as hidden inputs</request_stack_0>
  11. ... <request_stack_x>stack information</request_stack_x> </morphletResponse>
  12. <env> ... </env> <system> ... </system> <http> ... </http> </root> -->
  13. <xsl:stylesheet version="1.0"
  14. xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  15. xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  16. exclude-result-prefixes="xsl xts xtsext">
  17. <xsl:output method="html" version="1.0" encoding="UTF-8"
  18. indent="no" omit-xml-declaration="yes" />
  19. <xsl:key name="system-param" match="/*[local-name()='root']/system/param"
  20. use="@name" />
  21. <xsl:key name="env-param" match="/*[local-name()='root']/env/param"
  22. use="@name" />
  23. <xsl:key name="user-param" match="/*[local-name()='root']/user/param"
  24. use="@name" />
  25. <pf:variables />
  26. <xsl:template
  27. match="/*[local-name()='root']/*[local-name()='morphletResponse']/*[local-name()='markup']"
  28. priority="1">
  29. <xsl:variable name="webRoot">
  30. <xsl:choose>
  31. <xsl:when test="/root/http/param[@name='WEB_CONTENT_ROOT']">
  32. <xsl:value-of select="string(/root/http/param[@name='WEB_CONTENT_ROOT'])" />
  33. </xsl:when>
  34. <!-- No official config param is present. Make this relative. -->
  35. <xsl:otherwise>
  36. ..
  37. </xsl:otherwise>
  38. </xsl:choose>
  39. </xsl:variable>
  40. <xsl:variable name="app" select="key('system-param', 'app')" />
  41. <xsl:variable name="gateway"
  42. select="string(/root/http/param[@name='SCRIPT_NAME'])" />
  43. <xsl:variable name="user_skin">
  44. <xsl:choose>
  45. <xsl:when test="key('user-param', 'skin') != ''">
  46. <xsl:value-of select="key('user-param', 'skin')" />
  47. </xsl:when>
  48. <xsl:otherwise>
  49. <xsl:value-of
  50. select="key('system-param', 'defaultPortalPreferences')/pref[@name='skin']" />
  51. </xsl:otherwise>
  52. </xsl:choose>
  53. </xsl:variable>
  54. <xsl:variable name="skin_root"
  55. select="concat($webRoot, '/skins', '/', $user_skin)" />
  56. <xsl:variable name="skin_style"
  57. select="concat($skin_root, '/', $app, '/default.css')" />
  58. <xsl:variable name="skin_fonts" select="concat($skin_root, '/fonts.css')" />
  59. <xsl:variable name="skin_banner"
  60. select="concat($skin_root, '/shared/banner.css')" />
  61. <xsl:variable name="skin_portlet"
  62. select="concat($skin_root, '/fragments/portlet.css')" />
  63. <xsl:variable name="skin_shared_images"
  64. select="concat($skin_root, '/shared/images/')" />
  65. <!-- produce the HTML to be displayed -->
  66. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text>
  67. <html lang="{$productLocale}">
  68. <head>
  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
  78. select="key('env-param', 'm')" /></xsl:attribute>
  79. </meta>
  80. <meta content="IE=edge" http-equiv="X-UA-Compatible"/>
  81. <meta http-equiv="Expires" content="0" />
  82. <title>
  83. <xsl:value-of select="../*[local-name()='browserTitle']" />
  84. </title>
  85. <link rel="stylesheet" type="text/css">
  86. <xsl:attribute name="href">
  87. <xsl:value-of select="$skin_style" />
  88. </xsl:attribute>
  89. </link>
  90. <link rel="stylesheet" type="text/css" href="{$skin_fonts}" />
  91. </head>
  92. <body onload="if (window.init) init();" onscroll="do_onScroll()"
  93. style="overflow: auto;" role="region" aria-label="{../*[local-name()='browserTitle']}">
  94. <xsl:choose>
  95. <xsl:when
  96. test="/*[local-name()='root']/*[local-name()='morphletResponse']/*[local-name()='isPopup'] = 'true'">
  97. <xsl:attribute name="topmargin">0</xsl:attribute>
  98. <xsl:attribute name="bottommargin">0</xsl:attribute>
  99. <xsl:attribute name="marginheight">0</xsl:attribute>
  100. <xsl:attribute name="rightmargin">0</xsl:attribute>
  101. <xsl:attribute name="leftmargin">0</xsl:attribute>
  102. <xsl:attribute name="marginwidth">0</xsl:attribute>
  103. <xsl:attribute name="class">body_dialog_modal</xsl:attribute>
  104. </xsl:when>
  105. <xsl:otherwise>
  106. <xsl:attribute name="topmargin">3</xsl:attribute>
  107. <xsl:attribute name="bottommargin">0</xsl:attribute>
  108. <xsl:attribute name="marginheight">3</xsl:attribute>
  109. <xsl:attribute name="rightmargin">3</xsl:attribute>
  110. <xsl:attribute name="leftmargin">3</xsl:attribute>
  111. <xsl:attribute name="marginwidth">3</xsl:attribute>
  112. <xsl:attribute name="class">dialogBody</xsl:attribute>
  113. </xsl:otherwise>
  114. </xsl:choose>
  115. <script language="javascript">
  116. function do_onScroll()
  117. {
  118. modalDiv = document.getElementById('makeModalDiv')
  119. if (modalDiv &amp;&amp; modalDiv.style.display == 'block')
  120. {
  121. modalDiv.style.left = document.body.scrollLeft;
  122. modalDiv.style.top = document.body.scrollTop;
  123. }
  124. }
  125. </script>
  126. <form name="pform" method="post" action="{$gateway}">
  127. <xsl:copy-of select="*" />
  128. <xsl:copy-of
  129. select="/*[local-name()='root']/*[local-name()='formFields']/*" />
  130. </form>
  131. <xsl:if test="../*[local-name()='debugDump']">
  132. <xsl:copy-of select="../*[local-name()='debugDump']" />
  133. </xsl:if>
  134. </body>
  135. </html>
  136. </xsl:template>
  137. <xsl:template match="text()" priority="0" />
  138. </xsl:stylesheet>