Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > getting SOAPBody elements with xsl

Reply
Thread Tools

getting SOAPBody elements with xsl

 
 
wsdeveloper
Guest
Posts: n/a
 
      09-22-2005
I have a SOAP Message like the following:
<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="CreateCoordinationContext.xsl"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlnssd="http://www.w3.org/2001/XMLSchema"
xmlnssi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsa:Action soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

http://schemas.xmlsoap.org/ws/2004/1...inationContext
</wsa:Action>
<wsa:To soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

http://dutige.st.ewi.tudelft.nl/wstf...ces/Activation
</wsa:To>
<wsa:ReplyTo soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:Address>urn:Initiator</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
uuid:92f447576866786d:40a96d8e:10631b4fd84:-7fff
</wsa:MessageID>
</soapenv:Header>
<soapenv:Body>
<CreateCoordinationContext
xmlns="http://schemas.xmlsoap.org/ws/2004/10/wscoor">
<Expires>0</Expires>
<CoordinationType>http://schemas.xmlsoap.org/ws/2004/10/wsat</CoordinationType>
</CreateCoordinationContext>
</soapenv:Body>
</soapenv:Envelope>

what i would like to extract is the value of Expires and
CreateCoordinationContext elements but nothing seems to work
i tried the following:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:a="http://schemas.xmlsoap.org/ws/2004/10/wscoor"
exclude-result-prefixes="soapenv" version="1.0">
<xsl:template match="/">
<html>
<body>
<h2>SOAP BODY</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Expires</th>
<th align="left">CoordinationType</th>
</tr>
<tr>
<td>
<xsl:value-of
select="/soapenv:Envelope/soapenv:Body/a:CreateCoordinationContext/a:Expires"/>
</td>
<td>
<xsl:value-of
select="/soapenv:Envelope/soapenv:Body/node()[1]/node()[2]"/>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
but i don't get any answer i don't see where is the problem.
Thanks in advance fo any suggestion.

 
Reply With Quote
 
 
 
 
wsdeveloper
Guest
Posts: n/a
 
      09-22-2005
i have found the error so for anyone intersted i post it here.
first the SOAP should not have any ref to the xsl:
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlnssd="http://www.w3.org/2001/XMLSchema"xmlnssi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
<wsa:Action
soapenv:mustUnderstand="0"xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

http://schemas.xmlsoap.org/ws/2004/1...inationContext
</wsa:Action>
<wsa:To soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">

http://dutige.st.ewi.tudelft.nl/wstf...ces/Activation
</wsa:To>
<wsa:ReplyTo soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
<wsa:Address>urn:Initiator</wsa:Address>
</wsa:ReplyTo>
<wsa:MessageID
soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
soapenv:mustUnderstand="0"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing">
uuid:92f447576866786d:40a96d8e:10631b4fd84:-7fff
</wsa:MessageID>
</soapenv:Header>
<soapenv:Body>
<CreateCoordinationContext
xmlns="http://schemas.xmlsoap.org/ws/2004/10/wscoor">
<Expires>0</Expires>

<CoordinationType>http://schemas.xmlsoap.org/ws/2004/10/wsat</CoordinationType>
</CreateCoordinationContext>
</soapenv:Body>
</soapenv:Envelope>

then the xsl should look like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet xmlnssl="http://www.w3.org/1999/XSL/Transform"
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wscoor="http://schemas.xmlsoap.org/ws/2004/10/wscoor"
exclude-result-prefixes="soapenv" version="1.0">
<xsl:template match="/">
<html>
<body>
<h2>SOAP BODY</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th align="left">Expires</th>
<th align="left">CoordinationType</th>
</tr>
<tr>
<td>
<xsl:value-of
select="/soapenv:Envelope/soapenv:Body/wscoor:CreateCoordinationContext/wscoor:Expires"/>
</td>
<td>
<xsl:value-of
select="/soapenv:Envelope/soapenv:Body/wscoor:CreateCoordinationContext/wscoor:CoordinationType"/>
</td>
</tr>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

so the different namespaces have to be imported in the xsl.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SOAPBody and WS-I Compliance jonested@gmail.com Java 0 01-11-2006 06:41 PM
xsl to group elements? [xsl newbie] Rob Smegma XML 1 09-26-2005 10:59 AM
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
Help: WS-I doc/lit wsdl with anyType SOAPBody Sonna Nach XML 0 03-08-2005 10:50 AM
XSL-1000: (Fatal Error) Error while parsing XSL file (org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy) Kevin Flood Java 0 09-08-2004 02:11 PM



Advertisments