search.xslt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:frag="http://developer.cognos.com/schemas/cps/logic/fragment/1/"
  15. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  16. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  17. xmlns:ui="http://developer.cognos.com/schemas/cps/logic/ui/1/"
  18. xmlns:nui="http://developer.cognos.com/schemas/cps/logic/nav/ui/1/"
  19. xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/"
  20. exclude-result-prefixes="xts xtsext ui nui nav">
  21. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  22. <xsl:variable name="view" select="'search'"/>
  23. <xsl:include href="/mvc/includes/common-include.xslt"/>
  24. <xsl:include href="/mvc/includes/render-templates.xslt"/>
  25. <xsl:variable name="response" select="/root/logic/nav:searchResponse"/>
  26. <xsl:variable name="content" select="$response/nav:content"/>
  27. <xsl:variable name="path-separator">&#160;>&#160;</xsl:variable>
  28. <xsl:template match="/">
  29. <response>
  30. <xsl:choose>
  31. <xsl:when test="/root/logic/error">
  32. <fragment>
  33. <xsl:copy-of select="/root/logic/error"/>
  34. </fragment>
  35. </xsl:when>
  36. <xsl:otherwise>
  37. <fragment>
  38. <markup>
  39. <markupXml>
  40. <xsl:call-template name="render"/>
  41. </markupXml>
  42. </markup>
  43. </fragment>
  44. </xsl:otherwise>
  45. </xsl:choose>
  46. </response>
  47. </xsl:template>
  48. <xsl:template name="render">
  49. <script>
  50. function _THIS_navigate(id) {
  51. var payload = {"folder-id" : id, "context" : "mvc-remote-search"};
  52. _THIS_.raiseEvent("fragment.search.navigateTo", payload);
  53. }
  54. </script>
  55. <xsl:call-template name="common-include"/>
  56. <xsl:apply-templates select="$content"/>
  57. </xsl:template>
  58. <xsl:template match="nav:content">
  59. <table>
  60. <tr>
  61. <td width="100%"/>
  62. <td>
  63. <xsl:call-template name="render-pager-control">
  64. <xsl:with-param name="content" select="$content"/>
  65. </xsl:call-template>
  66. </td>
  67. </tr>
  68. </table>
  69. <xsl:call-template name="render-pager">
  70. <xsl:with-param name="content" select="."/>
  71. </xsl:call-template>
  72. </xsl:template>
  73. <xsl:template name="build-breadcrumb">
  74. <xsl:param name="fullPath"/>
  75. <xsl:param name="currentName"/>
  76. <xsl:variable name="path-stack">
  77. <xsl:apply-templates select="$fullPath/nav:pathStep/nav:pathStep"/>
  78. <path><name><xsl:value-of select="$currentName"/></name></path>
  79. </xsl:variable>
  80. <xsl:call-template name="render-breadcrumb">
  81. <xsl:with-param name="path-stack" select="$path-stack"/>
  82. </xsl:call-template>
  83. </xsl:template>
  84. <xsl:template match="nav:pathStep">
  85. <path><name><xsl:value-of select="nav:name"/></name></path>
  86. <xsl:apply-templates select="nav:pathStep"/>
  87. </xsl:template>
  88. </xsl:stylesheet>