Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
SolvedPrivate

Need XSLT

Posted on 2013-12-20
1
28 Views
Last Modified: 2016-02-26
Hi,

I have the below response received from a SOAP request. I need to take a value and put it in a table with Header as "Error Message". Output needs to be in HTML format.

Below is the SOAP error response:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
      <s:Body>
            <s:Fault>
                  <faultcode>s:Server</faultcode>
                  <faultstring>SAMPLE TEXT</faultstring>
                  <detail>
                        <ProcessingFault xmlns="http:/abcd.com/Invoice/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                              <Code>1234</Code>
                              <Message>SAMPLE TEXT</Message>
                        </ProcessingFault>
                  </detail>
            </s:Fault>
      </s:Body>
</s:Envelope>

I want the value of tag Message and Code in a table with header as ERROR MESSAGE and ERROR CODE.

Please assist.

Regards
Pradeep
0
Comment
Question by:Pradeep0308
1 Comment
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 500 total points
ID: 39731584
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:inv="http:/abcd.com/Invoice/"
    xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
    exclude-result-prefixes="xsd s inv"
    version="1.0">
    
    <xsl:template match="/">
        <html>
            <head></head>
            <body>
                <xsl:apply-templates select="//s:Body"/>
            </body>
        </html>
    </xsl:template>
    
    <xsl:template match="s:Body">
        <table border="1">
            <tr>
                <th>Code</th>
                <th>Message</th>
            </tr>
            <xsl:apply-templates select="s:Fault"/>
        </table>
    </xsl:template>
    
    <xsl:template match="s:Fault">
        <tr>
            <td><xsl:value-of select="//inv:ProcessingFault/inv:Code"/></td>
            <td><xsl:value-of select="//inv:ProcessingFault/inv:Message"/></td>
        </tr>
    </xsl:template>
</xsl:stylesheet>

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Getting attribute Values using xslt 4 54
Path of Workbook 3 86
XSLT: Is it possible to assign number format from a variable? 5 48
Post xml via PHP Soap Client 3 61
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question