SolvedPrivate

Need XSLT

Posted on 2013-12-20
1
30 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
[X]
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
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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

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…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
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…
Suggested Courses

752 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