Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   XML (http://www.velocityreviews.com/forums/f32-xml.html)
-   -   getting SOAPBody elements with xsl (http://www.velocityreviews.com/forums/t169904-getting-soapbody-elements-with-xsl.html)

wsdeveloper 09-22-2005 09:56 AM

getting SOAPBody elements with xsl
 
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/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="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 xmlns:xsl="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.


wsdeveloper 09-22-2005 02:03 PM

Re: getting SOAPBody elements with xsl
 
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/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="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 xmlns:xsl="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.



All times are GMT. The time now is 10:26 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.