presentation.xsl 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: EMF
  5. (C) Copyright IBM Corp. 2005, 2015
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0"
  9. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  10. xmlns:edp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/presentation/"
  11. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  12. xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/"
  13. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  14. xmlns:out="dummy-uri"
  15. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  16. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  17. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  18. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="xsl edp dp dt cp xtsext xts utml cm">
  19. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  20. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  21. <!--
  22. edp:evtpage
  23. -->
  24. <xsl:variable name="edp-namespace-uri"
  25. select="'http://developer.cognos.com/schemas/xts/logicsheets/xslt/ags/presentation/'"/>
  26. <!--
  27. dp:page - hold entire page from open body tag to close
  28. -->
  29. <xsl:template match="edp:evtpage">
  30. <html>
  31. <out:attribute name="lang">
  32. <out:choose>
  33. <out:when test="/root/session">
  34. <out:value-of select="/root/session/param[@name='productLocale']"/>
  35. </out:when>
  36. <out:when test="/root/http">
  37. <out:value-of select="/root/http/param[@name='HTTP_ACCEPT_LANGUAGE']"/>
  38. </out:when>
  39. <out:otherwise>
  40. <out:value-of select="''"/>
  41. </out:otherwise>
  42. </out:choose>
  43. </out:attribute>
  44. <out:if test="$is-ui-rtl">
  45. <out:attribute name="class">rtl</out:attribute>
  46. </out:if>
  47. <head>
  48. <xsl:if test="dp:meta">
  49. <xsl:copy-of select="dp:meta/child::node()"/>
  50. </xsl:if>
  51. <!-- add caching prevention instructions as required -->
  52. <xsl:if test="@cache = 'false'">
  53. <meta http-equiv="expires" content="0"/>
  54. </xsl:if>
  55. <title>
  56. <xsl:if test="@title">
  57. <xts:string id="{@title}"/>
  58. </xsl:if>
  59. <xsl:if test="@longTitle">
  60. <out:value-of select="{@longTitle}"/>
  61. </xsl:if>
  62. </title>
  63. <link rel="stylesheet" type="text/css">
  64. <out:attribute name="href">
  65. <xsl:choose>
  66. <!-- a morphlet can specify its own stylesheet. @stylesheet must contain a full path to the desired stylesheet. -->
  67. <xsl:when test="@stylesheet">
  68. <out:value-of select="@stylesheet"/>
  69. </xsl:when>
  70. <xsl:otherwise>
  71. <out:value-of select="$skin_style"/>
  72. </xsl:otherwise>
  73. </xsl:choose>
  74. </out:attribute>
  75. </link>
  76. <link rel="stylesheet" type="text/css" href="{'{$skin_fonts}'}"/>
  77. <xsl:if test="dp:script">
  78. <xsl:copy-of select="dp:script/child::node()"/>
  79. </xsl:if>
  80. </head>
  81. <!-- temporary theme selector, this will go on all match thms to switch using a url parameter -->
  82. <!-- define a function to call other that init() if required -->
  83. <xsl:variable name="initFunction">
  84. <xsl:choose>
  85. <xsl:when test="@initFunction"><xsl:value-of select="@initFunction"/></xsl:when>
  86. <xsl:otherwise><xsl:text>init</xsl:text></xsl:otherwise>
  87. </xsl:choose>
  88. </xsl:variable>
  89. <out:variable name="headerTitle"><xsl:copy-of select=".//dp:header/dp:title/*"/></out:variable>
  90. <body onload="if (window.{$initFunction}) {$initFunction}();" >
  91. <xsl:attribute name="topmargin">3</xsl:attribute>
  92. <xsl:attribute name="bottommargin">0</xsl:attribute>
  93. <xsl:attribute name="marginheight">3</xsl:attribute>
  94. <xsl:attribute name="rightmargin">3</xsl:attribute>
  95. <xsl:attribute name="leftmargin">3</xsl:attribute>
  96. <xsl:attribute name="marginwidth">3</xsl:attribute>
  97. <!-- allows the template coder to explicitly specify the role -->
  98. <xsl:choose>
  99. <xsl:when test="@role">
  100. <xsl:attribute name="role"><xsl:value-of select="@role"/></xsl:attribute>
  101. </xsl:when>
  102. <xsl:otherwise>
  103. <xsl:attribute name="role">region</xsl:attribute>
  104. <out:if test="true()">
  105. <out:variable name="pageLabel"><xsl:copy-of select="dp:pageLabel/*"/></out:variable>
  106. <out:if test="($headerTitle != '' or '{@longTitle}' != '') and $pageLabel =''">
  107. <out:attribute name="aria-labelledby">dialogHeaderTitle</out:attribute>
  108. </out:if>
  109. </out:if>
  110. </xsl:otherwise>
  111. </xsl:choose>
  112. <out:if test="true()">
  113. <out:variable name="pageLabel"><xsl:copy-of select="dp:pageLabel/*"/></out:variable>
  114. <out:if test="$pageLabel !='' ">
  115. <out:attribute name="aria-labelledby">bodyRoleLabel</out:attribute>
  116. </out:if>
  117. </out:if>
  118. <out:if test="$browser = 'ie'">
  119. <out:attribute name="style">overflow:auto</out:attribute>
  120. </out:if>
  121. <out:attribute name="class">
  122. <xsl:if test="@class"><xsl:value-of select="concat(@class,' ')"/></xsl:if>
  123. <out:choose>
  124. <out:when test="/root/env/param[@name='md.callBack']">body_dialog_modal</out:when>
  125. <out:otherwise>dialogBody</out:otherwise>
  126. </out:choose>
  127. </out:attribute>
  128. <out:if test="$is-ui-rtl">
  129. <out:attribute name="dir">rtl</out:attribute>
  130. </out:if>
  131. <out:if test="true()">
  132. <out:variable name="pageLabel"><xsl:copy-of select="dp:pageLabel/*"/></out:variable>
  133. <out:if test="$pageLabel !=''">
  134. <span id="bodyRoleLabel" style="position: absolute;margin-left: -9999px; margin-top: -9999px; "><out:value-of select="$pageLabel"/></span>
  135. </out:if>
  136. </out:if>
  137. <!-- apply templates to whatever is in the page tag -->
  138. <a href="#maincontent" tabindex="0" class="showOnFocus"><xts:string id="IDS_SECTION508_JUMPTOMAIN"/></a>
  139. <xsl:if test=".//cp:tabset[@id='maintabs']">
  140. <a href="#maintabs" tabindex="0" class="showOnFocus"><xts:string id="IDS_SECTION508_JUMPTOTABS"/></a>
  141. </xsl:if>
  142. <xsl:apply-templates select="*[not(self::dp:meta) and not(self::dp:script) and not(self::dp:pageLabel)]"/>
  143. </body>
  144. </html>
  145. </xsl:template>
  146. <!-- the main engine -->
  147. <xsl:template match="*">
  148. <xsl:copy>
  149. <xsl:copy-of select="@*"/>
  150. <xsl:apply-templates/>
  151. </xsl:copy>
  152. </xsl:template>
  153. </xsl:stylesheet>