get_capabilities.xslt 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 to create a string that contains global user capabilities specific to Event Studio. Each capability is delimited by a semi-colon
  10. Usage :
  11. <root>
  12. <effectiveCapabilities>
  13. <item>canUseContentStoreTool</item>
  14. </effectiveCapabilities>
  15. <globalCapabilities>
  16. <item>...</item>
  17. </globalCapabilities>
  18. </root>
  19. -->
  20. <xsl:stylesheet version="1.0"
  21. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  22. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  23. exclude-result-prefixes="xsl xts">
  24. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  25. <xsl:template match="/root">
  26. <capabilities>
  27. <xsl:call-template name="buildEffectiveCapString">
  28. <xsl:with-param name="items" select="./effectiveCapabilities/item"/>
  29. </xsl:call-template>
  30. <xsl:for-each select="./globalCapabilities/item">
  31. <!-- only copy if it's in the cache -->
  32. <xsl:variable name="cap"><xsl:value-of select="."/></xsl:variable>
  33. <!-- test this cap with what's in the users cache -->
  34. <xsl:if test="/root/*[local-name()='userCapabilities']/item[.=$cap]">
  35. <xsl:value-of select="$cap"/><xsl:text>;</xsl:text>
  36. </xsl:if>
  37. </xsl:for-each>
  38. </capabilities>
  39. </xsl:template>
  40. <xsl:template name="buildEffectiveCapString">
  41. <xsl:param name="items"/>
  42. <xsl:for-each select="$items">
  43. <xsl:value-of select="."/><xsl:text>;</xsl:text>
  44. </xsl:for-each>
  45. </xsl:template>
  46. </xsl:stylesheet>