Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Simple XML/XSL/HTML display

Posted on 2006-06-23
3
Medium Priority
?
269 Views
Last Modified: 2010-05-18
Hi, I have a error log file which comes in XML, something like:

<?xml version="1.0" encoding="UTF-8"?>
    <response requestHandle="4144037/1*174*2" requestType="add">
        <ack>successful</ack>
    </response>
    <response requestHandle="3555219/2*12*1" requestType="add">
        <error>Error messages
 &lt;itemHandle handle="CL18" type="nonInventorySaleItem"/&gt;
</error>
    </response>
    <response requestHandle="216039/3*29*1" requestType="add">
        <ack>successful</ack>
    </response>
    <response requestHandle="3334017/12*1*1" requestType="add">
        <ack>successful</ack>
    </response>
<response requestHandle="3555219/2*12*1" requestType="add">
        <error>Error messages
 &lt;itemHandle handle="CL18" type="nonInventorySaleItem"/&gt;
</error>
    </response>

I just want to be able to create some XSL that will be able to display the error messages, requestHandle, itemHandle, and type etc just in HTML table?


Anyone know how?
0
Comment
Question by:gaz1000
3 Comments
 
LVL 12

Accepted Solution

by:
jkmyoung earned 400 total points
ID: 16969304
First off, in order for xslt to process your xml, you're only allowed one element at the root level.
So, you'd have to encompass all of your xml inside of an element eg, like
<root>
  <response> blah.. </response>
  <response> etc.. etc.
...
</root>

Looks like you're looking for something like:
<table>
  <tr><!-- put your header row data here,.  --></tr>

  <xsl:for-each select="/root/response[error]"/> <!-- select all responses which have an error -->
    <tr>
      <td><xsl:value-of select="error" /></td>
      <td><xsl:value-of select="@requestHandle" /></td>
      <td><xsl:value-of select="substring-before(substring-after(error, 'handle=&quot;), '&quot;')" /></td>
      <td><xsl:value-of select="@requestType" /></td>
    </tr>
  </xsl:for-each>
</table>

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
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…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

971 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