SolvedPrivate

Need XSLT

Posted on 2013-12-20
1
26 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Conditional Formatting 4 37
Get last 10 digits of an xsl value-of field 7 58
VB.NET and XML parsing 6 67
Post xml via PHP Soap Client 3 39
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…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now