cogx-fault.xslt 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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:xts="http://developer.cognos.com/schemas/xts/"
  14. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  15. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  16. <!--
  17. <xsl:template match="/root">
  18. <cogxFault>
  19. <xsl:copy-of select="fault"/>
  20. <xsl:apply-templates select="fault"/>
  21. </cogxFault>
  22. </xsl:template>
  23. -->
  24. <xsl:template match="/root">
  25. <xsl:apply-templates select="fault"/>
  26. </xsl:template>
  27. <xsl:template match="fault">
  28. <xsl:choose>
  29. <xsl:when test="xts:exception/xts:exceptionCode = 'request.connecterror'">
  30. <!-- these are the only cogx errors we should raise as errors -->
  31. <xsl:copy>
  32. <xsl:copy-of select="@*"/>
  33. <xsl:apply-templates select="xts:exception" mode="root"/>
  34. </xsl:copy>
  35. </xsl:when>
  36. <xsl:otherwise>
  37. <!-- All other errors - pass up as part of the response and let the morphlet handle it -->
  38. <error><xsl:value-of select="xts:exception/xts:exceptionMsg"/></error>
  39. </xsl:otherwise>
  40. </xsl:choose>
  41. </xsl:template>
  42. <xsl:template match="xts:exception" mode="root">
  43. <xsl:copy>
  44. <xsl:copy-of select="@*"/>
  45. <bus:exception>
  46. <severity>error</severity>
  47. <errorCode>CCC-CGX-001</errorCode>
  48. <bus:message>
  49. <messageString><xts:string id="IDS_ERR_CGX_001"/></messageString>
  50. </bus:message>
  51. <bus:message>
  52. <messageString><xts:string id="IDS_ERR_CGX_002"><xts:param name="host"><xsl:value-of select="/root/system/param[@name='series7']/host"/></xts:param><xts:param name="port"><xsl:value-of select="/root/system/param[@name='series7']/port"/></xts:param></xts:string></messageString>
  53. </bus:message>
  54. <xsl:apply-templates select="descendant::bus:message | descendant::xts:exception"/>
  55. </bus:exception>
  56. </xsl:copy>
  57. </xsl:template>
  58. <xsl:template match="xts:exception">
  59. <bus:message>
  60. <messageString><xsl:value-of select="xts:exceptionMsg"/></messageString>
  61. </bus:message>
  62. </xsl:template>
  63. <xsl:template match="*">
  64. <xsl:copy>
  65. <xsl:copy-of select="@*"/>
  66. <xsl:apply-templates/>
  67. </xsl:copy>
  68. </xsl:template>
  69. </xsl:stylesheet>