123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2011
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fm="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/faultmsg/" xmlns:out="dummy-uri">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
- <xsl:template match="fm:get-fault-msg">
- <out:template name="get-fault-msg">
- <out:param name="response"/>
- <out:choose>
- <!--======================= header fault =======================-->
- <out:when test="$response//SOAP-ENV:Fault/faultcode = 'SOAP-ENV:MustUnderstand'">
- <!-- SOAP Header fault -->
- <out:apply-templates select="$response//SOAP-ENV:Header/faults:Misunderstood"/>
- </out:when>
- <out:otherwise>
- <!-- SOAP Body fault -->
- <out:apply-templates select="$response//SOAP-ENV:Fault"/>
- </out:otherwise>
- </out:choose>
- </out:template>
- <!-- handle a SOAP header fault -->
- <out:template match="faults:Misunderstood">
- <out:choose>
- <out:when test="descendant::*[local-name()='errorCode'] = '-38'">
- <!-- in this case show all the error messages -->
- <out:for-each select="descendant::*[local-name() = 'detail' or local-name() = 'errorDetail' or local-name() = 'errorMessage']">
- <out:if test="string-length(normalize-space(.)) > 0">
- <error>
- <out:value-of select="normalize-space(.)"/>
- </error>
- </out:if>
- </out:for-each>
- </out:when>
- <out:otherwise>
- <error>
- <out:value-of select="descendant::*[local-name() = 'errorMessage']"/>
- </error>
- <out:for-each select="descendant::*[local-name() = 'detail' or local-name() = 'errorDetail']">
- <out:if test="string-length(normalize-space(.)) > 0">
- <error>
- <out:value-of select="normalize-space(.)"/>
- </error>
- </out:if>
- </out:for-each>
- </out:otherwise>
- </out:choose>
- </out:template>
- <!-- handle a SOAP body fault -->
- <out:template match="SOAP-ENV:Fault">
- <out:choose>
- <out:when test="descendant::*[local-name() = 'exception']">
- <out:for-each select="descendant::*[local-name() = 'exception']">
- <error>
- <out:value-of select="@errorCode"/>
- <out:text>-</out:text>
- <out:choose>
- <out:when test="@errorCodeString != ''">
- <out:value-of select="@errorCodeString"/>
- </out:when>
- <out:otherwise>
- <out:value-of select="./bus:message"/>
- </out:otherwise>
- </out:choose>
- </error>
- </out:for-each>
- </out:when>
- <out:otherwise>
- <out:for-each select="*[local-name() = 'detail']/descendant::text()">
- <out:if test="string-length(normalize-space(.)) > 0">
- <error>
- <out:value-of select="normalize-space(.)"/>
- </error>
- <test/>
- </out:if>
- </out:for-each>
- </out:otherwise>
- </out:choose>
- </out:template>
- </xsl:template>
- <xsl:template match="*">
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates/>
- </xsl:copy>
- </xsl:template>
- </xsl:stylesheet>
|