sorry it took so long, i was quite busy, but thank you for your solution, it did get me started and i did learn a few things with this, thanks again.
Main Topics
Browse All TopicsHi Experts
I am writing a script (in PHP and Javascript) to communicate with a web service using SOAP requests. This works perfectly and has no problems.
What i was wondering is, when a message comes back from the soap request, how do I format it properly so that it can be displayed say for example in a table format or something alike? Applying some stylesheet to the soap message?
The SOAP message reply looks something like this:
#########
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://sche
<soapenv:Body>
<message>
<response from="gs2mgppdemo/TextQuer
<metadataList>
<metadata name="numDocsMatched">45</
<metadata name="numDocsReturned">10<
<metadata name="query">apple</metada
</metadataList>
<documentNodeList>
<documentNode docType="hierarchy" nodeID="HASH2e2c0786db13d2
<documentNode docType="hierarchy" nodeID="HASH9a32d65fe2d5e0
<documentNode docType="hierarchy" nodeID="HASH01e114881a5545
<documentNode docType="hierarchy" nodeID="HASH9a32d65fe2d5e0
<documentNode docType="hierarchy" nodeID="HASH9a32d65fe2d5e0
<documentNode docType="hierarchy" nodeID="HASH626d047760b154
<documentNode docType="hierarchy" nodeID="HASH01a99b6dc39959
<documentNode docType="hierarchy" nodeID="HASH2e2c0786db13d2
<documentNode docType="hierarchy" nodeID="HASH351102fcb484db
<documentNode docType="hierarchy" nodeID="HASH626d047760b154
</documentNodeList>
<termList>
<term field="" freq="54" name="apple" numDocsMatch="25" stem="3">
<equivTermList>
<term freq="" name="apples" numDocsMatch="" />
<term freq="" name="applicant" numDocsMatch="" />
<term freq="" name="Applied" numDocsMatch="" />
<term freq="" name="applied" numDocsMatch="" />
<term freq="" name="applies" numDocsMatch="" />
<term freq="" name="Applying" numDocsMatch="" />
<term freq="" name="applying" numDocsMatch="" />
</equivTermList>
</term>
</termList>
</response>
</message>
</soapenv:Body>
</soapenv:Envelope>
###########
I simply want to format the message so that it is displayable (doesn't even have to be too pretty with colours and sophisticated tables!).
Many thanks for your help!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: GertonePosted on 2007-10-13 at 23:37:04ID: 20073033
You should use XSLT for that
rg/1999/XS L/Transfor m" version="1.0"> apply-temp lates> :apply-tem plates> erm"/> > lue-of select="ancestor::term/@na me"/></td> lue-of select="ancestor::term/@fr eq"/></td> lue-of select="ancestor::term/@nu mDocsMatch "/></td> lue-of select="ancestor::term/@st em"/></td>
try this
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.o
<xsl:template match="/">
<html>
<body>
<xsl:apply-templates select="//response"></xsl:
</body>
</html>
</xsl:template>
<xsl:template match="response">
<xsl:apply-templates select=".//termList"></xsl
</xsl:template>
<xsl:template match="termList">
<table border="1">
<tr>
<th>Term</th>
<th>Frequency</th>
<th>Matching Docs</th>
<th>Stem</th>
<th>Equivalent Terms</th>
</tr>
<xsl:apply-templates select=".//equivTermList/t
</table>
</xsl:template>
<xsl:template match="equivTermList/term"
<xsl:param name="rspan" select="count(../term)" />
<tr>
<xsl:choose>
<xsl:when test="position() = 1">
<td rowspan="{$rspan}"><xsl:va
<td rowspan="{$rspan}"><xsl:va
<td rowspan="{$rspan}"><xsl:va
<td rowspan="{$rspan}"><xsl:va
<td><xsl:value-of select="@name"/></td>
</xsl:when>
<xsl:otherwise>
<td><xsl:value-of select="@name"/></td>
</xsl:otherwise>
</xsl:choose>
</tr>
</xsl:template>
</xsl:stylesheet>
cheers
geert