post-process-tabs.xslt 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  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" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  14. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  15. xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  16. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  17. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  18. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  19. exclude-result-prefixes="xsd xsi bus SOAP-ENC SOAP-ENV">
  20. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  21. <xsl:template match="/">
  22. <xsl:apply-templates select="SOAP-ENV:Body/bus:queryResponse"/>
  23. </xsl:template>
  24. <xsl:template match="bus:queryResponse">
  25. <xsl:apply-templates select="queryResult/item[1]/portalPages/value/* | queryResult/item/state"/>
  26. </xsl:template>
  27. <xsl:template match="item">
  28. <xsl:variable name="class" select="substring-after(@xsi:type, ':')"/>
  29. <xsl:element name="{$class}">
  30. <objectClass><xsl:value-of select="$class"/></objectClass>
  31. <xsl:apply-templates select="*[not(contains(@xsi:type, 'ArrayProp'))]"/>
  32. <xsl:if test="portalPages">
  33. <cm:portalPages>
  34. <xsl:apply-templates select="portalPages/value/item"/>
  35. </cm:portalPages>
  36. </xsl:if>
  37. <xsl:apply-templates select="permissions"/>
  38. </xsl:element>
  39. </xsl:template>
  40. <xsl:template match="*[not(contains(@xsi:type, 'ArrayProp'))]" priority="-99">
  41. <!-- simple properties -->
  42. <xsl:element name="{local-name()}" >
  43. <xsl:value-of select="value"/>
  44. </xsl:element>
  45. </xsl:template>
  46. <xsl:template match="permissions">
  47. <xsl:element name="permissions">
  48. <xsl:for-each select="value/item">
  49. <xsl:if test="position() > 1"><xsl:text> </xsl:text></xsl:if>
  50. <xsl:value-of select="."/>
  51. </xsl:for-each>
  52. </xsl:element>
  53. </xsl:template>
  54. <xsl:template match="state">
  55. <xsl:value-of select="./value" disable-output-escaping="yes"/>
  56. </xsl:template>
  57. </xsl:stylesheet>