breadcrumb.xsl 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  5. (C) Copyright IBM Corp. 2005, 2014
  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. <!--
  13. stylesheet will ensure that the breadcrumbs are separated by a ' > ', but what's inside the breadcrumb
  14. totally up to the caller. In most cases, the breadcrumb will be a link, and if uic:link is used you'll have to make
  15. you also include the common.xsl stylesheet.
  16. -->
  17. <xsl:stylesheet version="1.0"
  18. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  19. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  20. exclude-result-prefixes="xsl uic">
  21. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  22. <!--
  23. breadcrumbs
  24. -->
  25. <xsl:template match="uic:breadcrumbs">
  26. <div class="cogstyle-breadcrumbs-main">
  27. <xsl:copy-of select="@*[namespace-uri()='']"/>
  28. <xsl:apply-templates select="*">
  29. <xsl:with-param name="valign" select="'middle'"/>
  30. </xsl:apply-templates>
  31. </div>
  32. </xsl:template>
  33. <!--
  34. breadcrumb and complexBreadcrumb
  35. @type: the type of breadcrumb
  36. - plaintext: path is shown in a tooltip
  37. - navigate: standard breadcrumb used for navigation (default)
  38. -->
  39. <xsl:template match="uic:complexBreadcrumb | uic:breadcrumb">
  40. <xsl:choose>
  41. <!-- don't put any styles if we're building the breadcrumbs to be shown in a tooltip -->
  42. <xsl:when test="@type = 'plaintext'">
  43. <xsl:apply-templates>
  44. <xsl:with-param name="valign" select="'middle'"/>
  45. </xsl:apply-templates>
  46. <xsl:if test="(following-sibling::uic:complexBreadcrumb | following-sibling::uic:breadcrumb) and not(@uic:noSpace = 'true')">
  47. <xsl:text>&gt;</xsl:text>
  48. </xsl:if>
  49. </xsl:when>
  50. <!-- standard breadcrumb, so add the needed styles -->
  51. <xsl:otherwise>
  52. <xsl:if test="(preceding-sibling::uic:complexBreadcrumb | preceding-sibling::uic:breadcrumb)">
  53. <span>
  54. <xsl:attribute name="class">cogstyle-breadcrumbs-pathSeparator</xsl:attribute>
  55. <xsl:text> &gt; </xsl:text>
  56. </span>
  57. </xsl:if>
  58. <span>
  59. <xsl:attribute name="id">_THIS_breadcrumb<xsl:value-of select="position()"/></xsl:attribute>
  60. <xsl:if test="@lang != ''">
  61. <xsl:attribute name="lang"><xsl:value-of select="@lang"/></xsl:attribute>
  62. </xsl:if>
  63. <xsl:attribute name="class">
  64. <xsl:choose>
  65. <xsl:when test="(not(following-sibling::uic:complexBreadcrumb) and not(following-sibling::uic:breadcrumb)) or @type='leafnode'">cogstyle-breadcrumbs-pathLeafNode</xsl:when>
  66. <xsl:otherwise>cogstyle-breadcrumbs-pathLink</xsl:otherwise>
  67. </xsl:choose>
  68. </xsl:attribute>
  69. <xsl:apply-templates>
  70. <xsl:with-param name="valign" select="'middle'"/>
  71. </xsl:apply-templates>
  72. </span>
  73. </xsl:otherwise>
  74. </xsl:choose>
  75. </xsl:template>
  76. </xsl:stylesheet>