XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
steven matthewsSubject: Using XSLT with SOAP
Author: steven matthews
Date: 01 Jan 2007 03:56 PM
HI All,

I am trying to display the following simple SOAP message in a web browser using XSLT:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="calculate.xsl" type="text/xsl"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body><CalculateResponse xmlns="http://www.ntforl.com/">
<CalculateResult>0.772727251</CalculateResult>
</CalculateResponse>
</soap:Body>
</soap:Envelope>


I am using the following .xsl stylesheet (called calculate.xsl):

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<html>
<head>
<title>Web Services and SOAP messages</title>
</head>

<body>

<h3>The answer is:</h3>
<b><xsl:value-of select="soap:Body/CalculateResponse/CalculateResult"/></b>

</body>
</html>

</xsl:template>
</xsl:stylesheet>

I wish only to display the contents of CalculateResult, as follows:
<CalculateResult>0.772727251</CalculateResult>


I get an error that complains about 'soap:Body' element

Anyone got any suggestions ?

Steven Matthews

Postnext
Minollo I.Subject: Using XSLT with SOAP
Author: Minollo I.
Date: 01 Jan 2007 09:09 PM
You are missing the definition of a few namespaces, and one step in the XPath expression; try this:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:response="http://www.ntforl.com/">
...
<b><xsl:value-of select="soap:Envelope/soap:Body/response:CalculateResponse/response:CalculateResult"/></b>



Posttop
steven matthewsSubject: Using XSLT with SOAP
Author: steven matthews
Date: 02 Jan 2007 12:03 PM
Hi There,

Thanks for that, it works,

Steven M

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.